-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
linux/windows_virtual_machine_sccale_set: define Hash function for extension
block to ignore protected_setting
#11832
Conversation
// we need to ensure the whitespace is consistent | ||
settings := m["settings"].(string) | ||
if settings != "" { | ||
expandedSettings, err := structure.ExpandJsonFromString(settings) | ||
if err == nil { | ||
serializedSettings, err := structure.FlattenJsonToString(expandedSettings) | ||
if err == nil { | ||
buf.WriteString(fmt.Sprintf("%s-", serializedSettings)) | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since protected settings isn't returned this means we won't track any changes to that field, which is something we want to avoid - instead we'd need to conditionally add that to the hash here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the code to cache the existing extension
settings in state, keyed by the extension
name. The extension
name is guaranteed to be unique in Azure today, otherwise, you'll get:
Code="BadRequest" Message="On resource 'foobar', extension name 'CustomScript' cannot be used for more than one extension."
During the flattening of the protected_setting
, it will try to set it as long as there is something being set in the state. In v2.60.0, after changing the extension
from List to Set, the protected_settings
are not set back to the ResourceData
during a Read/Import, while it is set into the state during the create/update (persumably because the Read
got invoked during these operations will will read from source of config, which ends up being persisted into the state). Therefore, this fix should the state resulted into running the provisioning using v2.60.0 (verified locally).
@tombuildsstuff any chance of getting this in for 2.62.0? |
Ping @tombuildsstuff, is there anything I can do to make it merged? |
2.63.0 maybe? |
@tombuildsstuff - could you re-review? |
@tombuildsstuff any chance of getting this merged? I think it is the last thing needed to be able to move off the deprecated scale set resource |
@katbyte - are you able to help with this one? |
Paging @tombuildsstuff |
…xtension` block to ignore `protected_setting`
212e602
to
d90c39c
Compare
@katbyte @tombuildsstuff - any chance of getting this merged? Being stuck on the old scale set resource is causing us real problems now |
@tombuildsstuff @katbyte - bumping this one again... |
This functionality has been released in v2.78.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixes: #11820.
The hash function is similar to the old vmss below, with some minor diffs due to schema diffs: https://github.com/terraform-providers/terraform-provider-azurerm/blob/84d710e21fca7abcf36f513f1c278c3151721fb1/azurerm/internal/services/compute/virtual_machine_scale_set_resource.go#L774
Meanwhile, this PR removes some unnecessary ignores which are introduced in #11425.
Test Result
The only failure above is unrelated.