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

Check set equality for service account scope changes #1130

Merged
merged 5 commits into from
Feb 27, 2018

Conversation

danawillow
Copy link
Contributor

nList := n.([]interface{})
scopesChange := len(oList) != len(nList)
// service_account has MaxItems: 1
if len(oList) == 1 && len(nList) == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can skip these checks if scopesChange is already true, right? So you could make this scopesChange && len(oList) == 1? It seems a little clearer to me that way, but I'm not an expert here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I went for extreme clarity here, let me know what you think

// Attributes which can only be changed if the instance is stopped
if d.HasChange("machine_type") || d.HasChange("min_cpu_platform") || d.HasChange("service_account") {
if d.HasChange("machine_type") || d.HasChange("min_cpu_platform") || d.HasChange("service_account.0.email") || scopesChange {
Copy link
Contributor

Choose a reason for hiding this comment

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

My extremely mild preference is for scopesChange to be first in this list, on the principle that people only read the first item or two in a list, and if the first two items are the same sort of thing, even more so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}

create_timeout = 5

metadata_startup_script = "echo Hello"
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember making this one different on purpose - it was essential to catching some issues with metadata_startup_script vs metadata.startup-script a few weeks ago. Did you know about all that already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think you changed it for the _basic test, which meant that the _update one now had a change on metadata_startup_script, which is a ForceNew attribute. This updates the _update test to match so the only things that change are updatable fields.

@danawillow danawillow merged commit 313eb0f into hashicorp:master Feb 27, 2018
@danawillow danawillow deleted the is-1108 branch February 27, 2018 22:29
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this pull request Sep 27, 2019
Signed-off-by: Modular Magician <magic-modules@google.com>
@ghost
Copy link

ghost commented Mar 29, 2020

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 Mar 29, 2020
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.

Updating tags leads to instance restart
2 participants