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_mobile_network_sim_group - update schema #20474

Merged
merged 2 commits into from
Feb 23, 2023

Conversation

ziyeqf
Copy link
Contributor

@ziyeqf ziyeqf commented Feb 15, 2023

update per #20339 (comment)

test

terraform-provider-azurerm ❯ TF_ACC=1 go test -v ./internal/services/mobilenetwork -run=TestAccMobileNetworkSimGroup -timeout=600m
=== RUN   TestAccMobileNetworkSimGroupDataSource_complete
=== PAUSE TestAccMobileNetworkSimGroupDataSource_complete
=== RUN   TestAccMobileNetworkSimGroup_basic
=== PAUSE TestAccMobileNetworkSimGroup_basic
=== RUN   TestAccMobileNetworkSimGroup_withEncryptionKeyUrl
=== PAUSE TestAccMobileNetworkSimGroup_withEncryptionKeyUrl
=== RUN   TestAccMobileNetworkSimGroup_requiresImport
=== PAUSE TestAccMobileNetworkSimGroup_requiresImport
=== RUN   TestAccMobileNetworkSimGroup_complete
=== PAUSE TestAccMobileNetworkSimGroup_complete
=== RUN   TestAccMobileNetworkSimGroup_update
=== PAUSE TestAccMobileNetworkSimGroup_update
=== CONT  TestAccMobileNetworkSimGroupDataSource_complete
=== CONT  TestAccMobileNetworkSimGroup_requiresImport
=== CONT  TestAccMobileNetworkSimGroup_update
=== CONT  TestAccMobileNetworkSimGroup_complete
=== CONT  TestAccMobileNetworkSimGroup_withEncryptionKeyUrl
=== CONT  TestAccMobileNetworkSimGroup_basic
--- PASS: TestAccMobileNetworkSimGroup_basic (467.71s)
--- PASS: TestAccMobileNetworkSimGroup_requiresImport (491.87s)
--- PASS: TestAccMobileNetworkSimGroup_withEncryptionKeyUrl (760.82s)
--- PASS: TestAccMobileNetworkSimGroupDataSource_complete (781.69s)
--- PASS: TestAccMobileNetworkSimGroup_complete (782.60s)
--- PASS: TestAccMobileNetworkSimGroup_update (940.80s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/mobilenetwork 942.042s

@@ -64,7 +64,7 @@ func (r SimGroupResource) Arguments() map[string]*pluginsdk.Schema {
ValidateFunc: validation.IsURLWithHTTPorHTTPS,
},

"identity": commonschema.SystemOrUserAssignedIdentityOptional(),
"identity": commonschema.UserAssignedIdentityOptional(),
Copy link
Contributor

Choose a reason for hiding this comment

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

we also need to update the Expand and Flatten functions to account for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the typed model is correct so I think these functions are ok?

Copy link
Contributor

Choose a reason for hiding this comment

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

so if the service were to support system assigned, the provider would crash due to the flattened schema not matching what's defined in the schema - we'll need to ensure these are all using the user assigned values 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.

I dont think it will crash? with the flatten code accept both SystemAssigned and UserAssigned but only use the UserAssgined one .

func flattenMobileNetworkUserAssignedToNetworkLegacyIdentity(input *identity.LegacySystemAndUserAssignedMap) ([]identity.ModelUserAssigned, error) {
	if input == nil {
		return nil, nil
	}
	tmp := identity.UserAssignedMap{
		Type:        input.Type,
		IdentityIds: input.IdentityIds,
	}
	output, err := identity.FlattenUserAssignedMapToModel(&tmp)
	if err != nil {
		return nil, fmt.Errorf("expanding `identity`: %+v", err)
	}
	return *output, nil
}

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks @ziyeqf LGTM 🍐

@stephybun stephybun merged commit 9688a7b into hashicorp:main Feb 23, 2023
@github-actions github-actions bot added this to the v3.45.0 milestone Feb 23, 2023
stephybun added a commit that referenced this pull request Feb 23, 2023
@github-actions
Copy link

This functionality has been released in v3.45.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!

@github-actions
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants