-
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
azurerm_api_management
fix to pass all acctests
#7603
Conversation
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.
Left a few comments inline but this otherwise LGTM 👍
azurerm/internal/services/apimanagement/api_management_resource.go
Outdated
Show resolved
Hide resolved
@@ -820,6 +829,11 @@ func flattenApiManagementHostnameConfigurations(input *[]apimanagement.HostnameC | |||
output["host_name"] = *config.HostName | |||
} | |||
|
|||
// There'll always be a default custom domain with hostName "apim_name.azure-api.net" and Type "Proxy", which should be ignored | |||
if *config.HostName == strings.ToLower(name)+".azure-api.net" && config.Type == apimanagement.HostnameTypeProxy { |
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.
azure-api.net
is only valid in Azure Public - looks like this'll need to be fetched/added to the environments list in Azure/go-autorest
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.
Upstream issue opened: Azure/azure-rest-api-specs#10065
Dependent on Azure/go-autorest#540 |
0876e7f
to
7a86f5a
Compare
@tombuildsstuff hey can this get merged? This bug is annoying. |
7a86f5a
to
aa5f726
Compare
@tombuildsstuff I've rebased to the latest master branch. Thanks for your comments. All tests have passed. Please continue reviewing. === RUN TestAccAzureRMApiManagement_basic |
@manicminer All tests have passed. Please continue reviewing. |
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.
@yupwei68 Thanks, this looks great. I have a couple suggestions regarding the virtual_network_type
attribute and tidying up the tests a little.
Since the outputs of testAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionlessKeyVaultId()
, testAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionlessKeyVaultIdUpdateCD()
, testAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionedKeyVaultId()
and testAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionedKeyVaultIdUpdateCD()
are almost identical, could we consolidate these into a testAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurations_template()
function and only embed the differences in the other funcs? It would make the tests easier to reason about.
Aside from that, this looks good to me!
@@ -121,6 +121,9 @@ func resourceArmApiManagementService() *schema.Resource { | |||
}, | |||
}, | |||
|
|||
// Here we could not remove the `ForceNew` of the vnet type. Once we update the vnet type from `Internal` `External` to `None`, the destroy will fail because the subnet is still in use. | |||
// In the above case, it doesn't remove the link to subnet immediately. It'll be removed within 3 hours. | |||
// But if we destroy the APIM service with VNET type `Internal` or `External`, the subnet could be destroyed |
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.
If we can safely change from virtual_network_type = "None"
to one of the other values, it might be worth conditionally enforcing ForceNew?
e.g.
CustomizeDiff: customdiff.All(
customdiff.ForceNewIfChange("virtual_network_type", func(old, new, meta interface{}) bool {
return (old.(string) == string(apimanagement.VirtualNetworkTypeExternal) ||
old.(string) == string(apimanagement.VirtualNetworkTypeInternal)) &&
new.(string) == string(apimanagement.VirtualNetworkTypeNone)
}),
),
@yupwei68 is this ready for re-review? |
@manicminer Thanks for comments. Please continue reviewing. |
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.
Many thanks @yupwei68, this LGTM 🚀
This has been released in version 2.38.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.38.0"
}
# ... other configuration ... |
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 👉 [email protected]. Thanks! |
Fix: #7299
developer_portal
certificate keeps being updated, because in read function, when it gets d.Get("hostname_configuration") using key isstrings.Lower("DeveloperPortal")
instead "developer_portal"identity.0.type
=None
causes plan diff not empty, because it'll not be returned back. Fulfill the identity type in schema setting whenidentity.0.type
=None
.When
VirtualNetworkType = VirtualNetworkTypeInternal
, callsign_in
,sign_up
,policy
service api causes error.One default custom domain has been ignored because it causes plan refresh diff
key vault acctest needs to separate the steps because it depends on the permission assignment. But permission assignment depends on its identity. So it'll be a cycle dependency. Thus it needs to be separated into 3 steps
test:
=== RUN TestAccAzureRMApiManagement_basic
=== PAUSE TestAccAzureRMApiManagement_basic
=== CONT TestAccAzureRMApiManagement_basic
--- PASS: TestAccAzureRMApiManagement_basic (2751.90s)
=== RUN TestAccAzureRMApiManagement_requiresImport
=== PAUSE TestAccAzureRMApiManagement_requiresImport
=== CONT TestAccAzureRMApiManagement_requiresImport
--- PASS: TestAccAzureRMApiManagement_requiresImport (2500.16s)
=== RUN TestAccAzureRMApiManagement_customProps
=== PAUSE TestAccAzureRMApiManagement_customProps
=== CONT TestAccAzureRMApiManagement_customProps
--- PASS: TestAccAzureRMApiManagement_customProps (2551.24s)
=== RUN TestAccAzureRMApiManagement_complete
=== PAUSE TestAccAzureRMApiManagement_complete
=== CONT TestAccAzureRMApiManagement_complete
--- PASS: TestAccAzureRMApiManagement_complete (1451.06s)
=== RUN TestAccAzureRMApiManagement_signInSignUpSettings
=== PAUSE TestAccAzureRMApiManagement_signInSignUpSettings
=== CONT TestAccAzureRMApiManagement_signInSignUpSettings
--- PASS: TestAccAzureRMApiManagement_signInSignUpSettings (2473.22s)
=== RUN TestAccAzureRMApiManagement_policy
=== PAUSE TestAccAzureRMApiManagement_policy
=== CONT TestAccAzureRMApiManagement_policy
--- PASS: TestAccAzureRMApiManagement_policy (2488.46s)
=== RUN TestAccAzureRMApiManagement_virtualNetworkInternal
=== PAUSE TestAccAzureRMApiManagement_virtualNetworkInternal
=== CONT TestAccAzureRMApiManagement_virtualNetworkInternal
--- PASS: TestAccAzureRMApiManagement_virtualNetworkInternal (2593.72s)
=== RUN TestAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionedKeyVaultId
=== PAUSE TestAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionedKeyVaultId
=== CONT TestAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionedKeyVaultId
--- PASS: TestAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionedKeyVaultId (3016.47s)
=== RUN TestAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionlessKeyVaultId
=== PAUSE TestAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionlessKeyVaultId
=== CONT TestAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionlessKeyVaultId
--- PASS: TestAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionlessKeyVaultId (2984.86s)
=== RUN TestAccAzureRMApiManagement_identityUserAssigned
=== PAUSE TestAccAzureRMApiManagement_identityUserAssigned
=== CONT TestAccAzureRMApiManagement_identityUserAssigned
--- PASS: TestAccAzureRMApiManagement_identityUserAssigned (2584.16s)
=== RUN TestAccAzureRMApiManagement_identityNoneUpdateUserAssigned
=== PAUSE TestAccAzureRMApiManagement_identityNoneUpdateUserAssigned
=== CONT TestAccAzureRMApiManagement_identityNoneUpdateUserAssigned
--- PASS: TestAccAzureRMApiManagement_identityNoneUpdateUserAssigned (4731.82s)
=== RUN TestAccAzureRMApiManagement_identityUserAssignedUpdateNone
=== PAUSE TestAccAzureRMApiManagement_identityUserAssignedUpdateNone
=== CONT TestAccAzureRMApiManagement_identityUserAssignedUpdateNone
--- PASS: TestAccAzureRMApiManagement_identityUserAssignedUpdateNone (4973.29s)
=== RUN TestAccAzureRMApiManagement_identitySystemAssigned
=== PAUSE TestAccAzureRMApiManagement_identitySystemAssigned
=== CONT TestAccAzureRMApiManagement_identitySystemAssigned
--- PASS: TestAccAzureRMApiManagement_identitySystemAssigned (2417.97s)
=== RUN TestAccAzureRMApiManagement_identitySystemAssignedUpdateNone
=== PAUSE TestAccAzureRMApiManagement_identitySystemAssignedUpdateNone
=== CONT TestAccAzureRMApiManagement_identitySystemAssignedUpdateNone
--- PASS: TestAccAzureRMApiManagement_identitySystemAssignedUpdateNone (4725.02s)
=== RUN TestAccAzureRMApiManagement_identityNoneUpdateSystemAssigned
=== PAUSE TestAccAzureRMApiManagement_identityNoneUpdateSystemAssigned
=== CONT TestAccAzureRMApiManagement_identityNoneUpdateSystemAssigned
--- PASS: TestAccAzureRMApiManagement_identityNoneUpdateSystemAssigned (4483.66s)
=== RUN TestAccAzureRMApiManagement_identitySystemAssignedUserAssignedUpdateNone
=== PAUSE TestAccAzureRMApiManagement_identitySystemAssignedUserAssignedUpdateNone
=== CONT TestAccAzureRMApiManagement_identitySystemAssignedUserAssignedUpdateNone
--- PASS: TestAccAzureRMApiManagement_identitySystemAssignedUserAssignedUpdateNone (5097.89s)
=== RUN TestAccAzureRMApiManagement_identityNoneUpdateSystemAssignedUserAssigned
=== PAUSE TestAccAzureRMApiManagement_identityNoneUpdateSystemAssignedUserAssigned
=== CONT TestAccAzureRMApiManagement_identityNoneUpdateSystemAssignedUserAssigned
--- PASS: TestAccAzureRMApiManagement_identityNoneUpdateSystemAssignedUserAssigned (4758.50s)
=== RUN TestAccAzureRMApiManagement_identitySystemAssignedUserAssigned
=== PAUSE TestAccAzureRMApiManagement_identitySystemAssignedUserAssigned
=== CONT TestAccAzureRMApiManagement_identitySystemAssignedUserAssigned
--- PASS: TestAccAzureRMApiManagement_identitySystemAssignedUserAssigned (2421.46s)