Mikaël Gibert
d60381a693
Implement multiple version in instance group manager ( #1499 )
...
Hi there,
Here is an attempt to implement canary releases ( #1252 ). This is the first time I write golang and make a terraform contribution, I opened the PR to obtain feedback and advices so please let me know how I can improve this code!
In addition I used `make fmt` to format the code but left some lines bigger than 80 characters, do I need to split them ?
I tested the feature against a project with the following configuration:
```
resource "google_compute_health_check" "mikael-hackathon-healthcheck" {
name = "mikael-hackathon-healthcheck"
check_interval_sec = 1
timeout_sec = 1
healthy_threshold = 2
unhealthy_threshold = 10
http_health_check {
request_path = "/"
port = "80"
}
}
resource "google_compute_instance_template" "mikael-hackaton-template" {
name_prefix = "mikael-hackaton-"
description = "This template is used to create app server instances."
tags = ["loadbalanced", "internal-web", "hackaton"]
labels = {
environment = "hackaton"
}
instance_description = "Hackaton demo rolling upgrade"
machine_type = "n1-standard-1"
can_ip_forward = false
scheduling {
automatic_restart = true
on_host_maintenance = "MIGRATE"
}
disk {
source_image = "debian-cloud/debian-9"
disk_type = "pd-standard"
disk_size_gb = 20
auto_delete = true
boot = true
}
network_interface {
network = "default"
access_config = {}
}
service_account {
email = "${google_service_account.mikael-hackaton.email}"
scopes = ["cloud-platform"]
}
lifecycle {
create_before_destroy = true
}
metadata_startup_script = "apt-get update && apt-get install -y apache2 && echo I am stable version at $(hostname) > /var/www/html/index.html"
}
resource "google_compute_instance_template" "mikael-hackaton-template-canary" {
name_prefix = "mikael-hackaton-canary"
description = "This template is used to create app server instances."
tags = ["loadbalanced", "internal-web", "hackaton"]
labels = {
environment = "hackaton"
}
instance_description = "Hackaton demo rolling upgrade"
machine_type = "n1-standard-1"
can_ip_forward = false
scheduling {
automatic_restart = true
on_host_maintenance = "MIGRATE"
}
disk {
source_image = "debian-cloud/debian-9"
disk_type = "pd-standard"
disk_size_gb = 20
auto_delete = true
boot = true
}
network_interface {
network = "default"
access_config = {}
}
service_account {
email = "${google_service_account.mikael-hackaton.email}"
scopes = ["cloud-platform"]
}
lifecycle {
create_before_destroy = true
}
metadata_startup_script = "apt-get update && apt-get install -y apache2 && echo I am a canary at $(hostname) > /var/www/html/index.html"
}
resource "google_compute_target_pool" "mikael-hackaton-target-pool" {
name = "mikael-hackaton-target-pool"
}
resource "google_compute_instance_group_manager" "mikael-hackaton-manager" {
name = "mikael-hackaton-manager"
base_instance_name = "mikael-hackaton"
#instance_template = "${google_compute_instance_template.mikael-hackaton-template.self_link}"
update_strategy = "ROLLING_UPDATE"
zone = "${var.zone}"
target_pools = ["${google_compute_target_pool.mikael-hackaton-target-pool.self_link}"]
target_size = 5
version {
name = "primary"
instance_template = "${google_compute_instance_template.mikael-hackaton-template.self_link}"
}
version {
name = "canary"
instance_template = "${google_compute_instance_template.mikael-hackaton-template-canary.self_link}"
target_size_fixed = 1
}
named_port {
name = "http"
port = 80
}
auto_healing_policies {
health_check = "${google_compute_health_check.mikael-hackathon-healthcheck.self_link}"
initial_delay_sec = 10
}
rolling_update_policy {
type = "PROACTIVE"
minimal_action = "REPLACE"
max_surge_percent = 100
max_unavailable_percent = 50
min_ready_sec = 5
}
}
```
2018-06-04 15:34:48 -07:00
Dana Hoffman
8907321d60
Roll forward beta scaffolding PR ( #1453 )
...
* Revert "Merge pull request #1434 from terraform-providers/paddy_revert_beta"
This reverts commit 118cd71201
, reversing
changes made to d59fcbbc59
.
* add ConvertSelfLinkToV1 calls to places where beta links are stored
2018-05-09 11:24:40 -07:00
Paddy Carver
aa2626b490
Revert "remove switch statements between api versions for compute"
...
This reverts commit bf1b3a24e8c1cac832e74d9d0e145c7010a4c2f1.
2018-05-04 07:51:45 -07:00
Dana Hoffman
30409d315e
Remove switch statements between api versions for compute ( #1422 )
2018-05-03 12:24:21 -07:00
David Watson
b70db7b40a
Ensure that a terraform plan works if the resource does not exist (but is currently in the tfstate). ( #1340 )
2018-04-17 16:23:16 -07:00
Irena Shashchuk
d17c5a2a88
rIGM rolling update
2018-03-23 16:51:30 -04:00
Dana Hoffman
98baa31a05
Set wait_for_instances when importing IGMs, make defaults match ( #1235 )
2018-03-21 12:39:12 -07:00
Dana Hoffman
28efae534a
Add wait_for_instances field to IGM and self_link option to the IG data source ( #1222 )
...
* Add wait_for_instances field to IGM and self_link option to the IG data source
* don't be clever with errors
2018-03-20 14:20:43 -07:00
ishashchuk
14f1431896
Rolling update support for instance group manager ( #1137 )
2018-03-15 11:10:09 -07:00
Vincent Roseberry
dab491d28d
Make zone field consistent and truly optional for all resources ( #914 )
2018-01-03 16:18:40 -05:00
Nathan McKinley
114b646fae
Enable 'zone' to be specified at the provider level instead of per-resource. ( #816 )
...
- Fetch Zone attribute any place where it *was* being fetched from the schema by
combination schema / provider-level attribute.
- Allow region to be unspecified if zone is specified.
- Switch one example to using provider-level zone as an example.
- Make provider-level zone optional. (Individual resources will fail if they can't find a zone.)
- Add tests for getZone and getRegion.
2017-12-06 14:30:04 -08:00
Joe Selman
2765290724
Add label support to google_compute_snapshot ( #570 )
...
* Add label support to google_compute_snapshot
* Refactor operation polling code to use client directly
2017-10-13 15:36:03 -07:00
Vincent Roseberry
3027822917
Instance group manager cleanup ( #409 )
2017-09-13 17:06:07 -07:00
Riley Karson
ff8bdc9b52
Remove Beta operation waiting code and just wait at v1 instead. ( #319 )
2017-08-10 13:01:56 -07:00
Riley Karson
39423dd063
Stop shadowing err in version switches by using = over := ( #318 )
2017-08-10 10:29:18 -07:00
Riley Karson
3877b340e6
Add Beta support for auto_healing_policies to instance group manager. ( #249 )
...
* Add support for auto_healing_policies to google_compute_instance_group_manager.
* Add a test for self link stability when a v1 resource uses a versioned resource.
* Add a comment about what the stable self link test does.
* make fmt
* Fixed formatting on new tests.
* Address review comments.
* Fix make vet
2017-08-02 10:12:16 -07:00
Riley Karson
232cb87c7a
Add versioned Beta support to google_compute_instance_group_manager ( #234 )
...
* Vendor GCP Compute Beta client library.
* Refactor resource_compute_instance_group_manager for multi version support (#129 )
* Refactor resource_compute_instance_group_manager for multi version support.
* Minor changes based on review.
* Removed type-specific API version conversion functions.
* Add support for Beta operations.
* Add v0beta support to google_compute_instance_group_manager.
* Renamed Key to Feature, added comments & updated some parameter names.
* Fix code and tests for version finder to match fields that don't have a change.
* Store non-v1 resources' self links as v1 so that dependent single-version resources don't see diffs.
* Fix weird change to vendor.json from merge.
* Add a note that Convert loses ForceSendFields, fix failing test.
* Moved nil type to a switch case in compute_shared_operation.go.
* Move base api version declaration above schema.
2017-07-26 13:37:59 -07:00
Riley Karson
de9b9a05b5
go fmt
2017-06-16 15:41:26 -07:00
Riley Karson
3f26ea6425
Updated variable names and docs.
2017-06-16 15:39:44 -07:00
Riley Karson
78b0879c6d
Changed google_compute_instance_group_manager target_size default to 0.
2017-06-13 12:43:18 -07:00
Jake Champlin
66029ac431
Transfer google provider
2017-06-06 11:58:51 -04:00