Commit Graph

43 Commits

Author SHA1 Message Date
The Magician
4708ab21b3 Fix CI problems for 0.12 SDK (#3252)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2019-03-15 16:34:30 -07:00
The Magician
c5df1527ae Note version is required for beta IGM version (#3047)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-02-15 14:25:03 -08:00
The Magician
23db6b0c12 Fix golangci-lint errors (#3059)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-02-14 16:00:35 -08:00
The Magician
08c73f2754 Standardize import for instance group manager. (#2946)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-01-28 14:00:05 -08:00
The Magician
9e9524af70 Remove inferred region from igm (#2693)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
The Magician
29c665d865 Various linter cleanups (conversions, unused, misspellings) (#2681)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
The Magician
c605b0bc4b [Terraform]: Apply gofmt -s to all files managed by MM (#2676)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
The Magician
f26c910f80 Start removing beta igm/rigm fields. (#2393)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
Chris Stephens
db98fbd5e6 remove trigger_bucket and trigger_topic 2018-12-20 17:22:22 -08:00
The Magician
1c3da20140 CI change only - any change here will indicate a dependency on a ruby minor version. (#2298) 2018-12-20 17:22:22 -08:00
The Magician
fd6666b3ff Output from magician generating into ga and beta providers (#2271)
<!-- This change is generated by MagicModules. -->
/cc @danawillow
2018-12-20 17:22:22 -08:00
The Magician
bd348c5797 changes to (r)igm so that resources can be converted from beta back to ga (#2260)
<!-- This change is generated by MagicModules. -->
/cc @danawillow
2018-12-20 17:22:22 -08:00
Nathan McKinley
902675c324 Reverting 1.20 and 1.19 cherrypick branches. 2018-12-20 17:22:22 -08:00
The Magician
4a4a33da8a Output from magician generating into ga and beta providers (#2271)
<!-- This change is generated by MagicModules. -->
/cc @danawillow
2018-12-12 17:23:35 -08:00
Paddy
8e7347af4e
Merge branch 'master' into paddy_igm_deprecation 2018-10-03 19:08:29 -07:00
Paddy Carver
9a3dd8db6e Fix provider_versions.html link. 2018-10-03 18:46:20 -07:00
Riley Karson
ee67a87a65 Change deprecation message. 2018-10-03 12:58:52 -07:00
Paddy Carver
a3bd81460e Deprecate beta fields for (R)IGM.
Update (Regional) Instance Group Managers to deprecate the beta fields
(rolling_update_policy, versions, and auto_healing_policy). Also, rename
RESTART to REPLACE for Instance Group Manager's update_strategy, to be a
bit clearer. This required a DiffSuppress to make sure RESTART and
REPLACE are considered equivalent. In 2.0.0, we should remove RESTART
and drop the DiffSuppressFunc. Sadly, we have no way to do a deprecation
message for RESTART. We'll have to put it in the CHANGELOG. I've already
removed it from the website.
2018-10-02 17:22:42 -07:00
Riley Karson
a8747b4909 Deprecate handwritten beta fields. 2018-10-02 14:44:09 -07:00
oceyral
7da529f3c1 Implement multiple versions for regional instance groups (#1809) 2018-07-25 13:21:20 -07:00
Paddy
e08832c48c
Revert "Fix instance group manager rolling-updates" 2018-07-12 13:09:57 -07:00
Benjamin Pineau
633c2191ac Fix instance group manager rolling-updates
Currently, the rolling-update API expects a PUT (regionInstanceGroupManager.update())
instead of a PATCH (regionInstanceGroupManager.patch()) call, so immediate rolling updates
(as specified with `update_strategy = "ROLLING_UPDATE"``) are never triggered:

```
[DEBUG]: ---[ REQUEST ]---------------------------------------
[DEBUG]: POST /compute/beta/projects/mycompany-myapp-staging/regions/europe-west3/instanceGroupManagers/myapp-server/setInstanceTemplate?alt=json HTTP/1.1
....
[DEBUG]: ---[ RESPONSE ]--------------------------------------
...
[DEBUG]:  "warnings": [
[DEBUG]:   {
[DEBUG]:    "code": "FIELD_VALUE_OVERRIDEN",
[DEBUG]:    "message": "Update policy type was set to OPPORTUNISTIC. Please use regionInstanceGroupManager.update() to preserve the policy."
[DEBUG]:   }
```

refs:
https://cloud.google.com/compute/docs/reference/rest/beta/instanceGroupManagers/patch
https://cloud.google.com/compute/docs/reference/rest/beta/instanceGroupManagers/update

Fix #1506
2018-07-08 16:20:30 +02:00
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