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

azurerm_management_group_subscription_association - correctly mark as gone if not found during read #23335

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,9 @@ func resourceManagementGroupSubscriptionAssociationRead(d *pluginsdk.ResourceDat
}
found := false
if props := managementGroup.Properties; props != nil {
if props.Children == nil {
return fmt.Errorf("could not read properties for Management Group %q", id.ManagementGroup)
}

for _, v := range *props.Children {
if v.Type == managementgroups.Type1Subscriptions {
if v.Name != nil && *v.Name == id.SubscriptionId {
if props.Children != nil {
for _, v := range *props.Children {
if v.Type == managementgroups.Type1Subscriptions && v.Name != nil && *v.Name == id.SubscriptionId {
Copy link
Member

Choose a reason for hiding this comment

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

We should probably make this a case insensitive check here?

Suggested change
if v.Type == managementgroups.Type1Subscriptions && v.Name != nil && *v.Name == id.SubscriptionId {
if v.Type == managementgroups.Type1Subscriptions && v.Name != nil && strings.EqualFold(*v.Name, id.SubscriptionId) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks.

found = true
}
}
Expand Down