Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement multiple versions for regional instance groups #1809

Conversation

oceyral
Copy link
Contributor

@oceyral oceyral commented Jul 24, 2018

Related to Issue #1793.

This is essentially a port of PR #1499 for regional instance groups.

It was tested with the following :

## Instance group
resource "google_compute_region_instance_group_manager" "smtpin" {
  name = "smin00-${data.google_client_config.current.region}"
  region = "${data.google_client_config.current.region}"
  base_instance_name = "${var.mailjet_env}-li-smin00"
  target_size = "${data.consul_key_prefix.smtpin.var.scale}"
  update_strategy = "ROLLING_UPDATE"
  target_pools = ["${google_compute_target_pool.smtpin.self_link}"]

  rolling_update_policy {
    type = "PROACTIVE"
    minimal_action = "REPLACE"
    max_surge_fixed = 3
  }

  version {
    name = "smtpin-current"
    instance_template = "${google_compute_instance_template.smtpin-current.self_link}"
  }
  version {
    name = "smtpin-next"
    instance_template = "${google_compute_instance_template.smtpin-next.self_link}"
    target_size {
      fixed = 1
    }
  }
}

testacc passes when limited to the resource in question :

TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v  -timeout 120m -run 'RegionInstanceGroupManager'
?       github.com/terraform-providers/terraform-provider-google        [no test files]
=== RUN   TestAccRegionInstanceGroupManager_basic
=== PAUSE TestAccRegionInstanceGroupManager_basic
=== RUN   TestAccRegionInstanceGroupManager_targetSizeZero
=== PAUSE TestAccRegionInstanceGroupManager_targetSizeZero
=== RUN   TestAccRegionInstanceGroupManager_update
=== PAUSE TestAccRegionInstanceGroupManager_update
=== RUN   TestAccRegionInstanceGroupManager_updateLifecycle
=== PAUSE TestAccRegionInstanceGroupManager_updateLifecycle
=== RUN   TestAccRegionInstanceGroupManager_updateStrategy
=== PAUSE TestAccRegionInstanceGroupManager_updateStrategy
=== RUN   TestAccRegionInstanceGroupManager_rollingUpdatePolicy
=== PAUSE TestAccRegionInstanceGroupManager_rollingUpdatePolicy
=== RUN   TestAccRegionInstanceGroupManager_separateRegions
=== PAUSE TestAccRegionInstanceGroupManager_separateRegions
=== RUN   TestAccRegionInstanceGroupManager_versions
=== PAUSE TestAccRegionInstanceGroupManager_versions
=== RUN   TestAccRegionInstanceGroupManager_autoHealingPolicies
=== PAUSE TestAccRegionInstanceGroupManager_autoHealingPolicies
=== RUN   TestAccRegionInstanceGroupManager_distributionPolicy
=== PAUSE TestAccRegionInstanceGroupManager_distributionPolicy
=== CONT  TestAccRegionInstanceGroupManager_basic
=== CONT  TestAccRegionInstanceGroupManager_separateRegions
=== CONT  TestAccRegionInstanceGroupManager_updateStrategy
=== CONT  TestAccRegionInstanceGroupManager_updateLifecycle
=== CONT  TestAccRegionInstanceGroupManager_rollingUpdatePolicy
=== CONT  TestAccRegionInstanceGroupManager_distributionPolicy
=== CONT  TestAccRegionInstanceGroupManager_autoHealingPolicies
=== CONT  TestAccRegionInstanceGroupManager_versions
--- PASS: TestAccRegionInstanceGroupManager_basic (176.24s)
=== CONT  TestAccRegionInstanceGroupManager_update
--- PASS: TestAccRegionInstanceGroupManager_updateLifecycle (211.79s)
=== CONT  TestAccRegionInstanceGroupManager_targetSizeZero
--- PASS: TestAccRegionInstanceGroupManager_updateStrategy (247.28s)
--- PASS: TestAccRegionInstanceGroupManager_targetSizeZero (49.35s)
--- PASS: TestAccRegionInstanceGroupManager_versions (300.22s)
--- PASS: TestAccRegionInstanceGroupManager_rollingUpdatePolicy (305.20s)
--- PASS: TestAccRegionInstanceGroupManager_separateRegions (309.69s)
--- PASS: TestAccRegionInstanceGroupManager_distributionPolicy (370.74s)
--- PASS: TestAccRegionInstanceGroupManager_autoHealingPolicies (373.53s)
--- PASS: TestAccRegionInstanceGroupManager_update (215.24s)
PASS
ok      github.com/terraform-providers/terraform-provider-google/google 391.495s
testing: warning: no tests to run
PASS
ok      github.com/terraform-providers/terraform-provider-google/scripts        0.009s [no tests to run]

@nat-henderson nat-henderson self-requested a review July 24, 2018 22:10
Copy link
Contributor

@nat-henderson nat-henderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm comfortable with this, great. I'm running the tests now. If you could take a second look at that comment I flagged I'd appreciate it - I'll merge this as soon as I hear back from you.

@@ -346,6 +395,63 @@ func resourceComputeRegionInstanceGroupManagerRead(d *schema.ResourceData, meta
return nil
}

// Updates an instance group manager by applying an update strategy (REPLACE, RESTART) respecting a rolling update policy (availability settings,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This long parenthetical doesn't read very fluently - can you take another look at this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comment, is it better now ?

@nat-henderson
Copy link
Contributor

Tests all pass on our end as well. :)

@nat-henderson nat-henderson merged commit 7da529f into hashicorp:master Jul 25, 2018
chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
@ghost
Copy link

ghost commented Nov 17, 2018

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants