-
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
New resource: azurerm_api_management_custom_domain
#8228
Conversation
azurerm_api_management_custom_domain
resourceazurerm_api_management_custom_domain
This comment has been minimized.
This comment has been minimized.
You can vote for the issue to be prioritized by giving a 👍 reaction to the top-level issue description that this PR should solve: #3058 (comment). Whenever a maintainer has time to look through the proposed changes and additions, this PR can move forward. |
Rebased just in case. |
940ea70
to
c3af35f
Compare
azurerm_api_management_custom_domain
azurerm_api_management_custom_domain
@manicminer Is there any chance of this getting reviewed before 2.30.0? |
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.
Hi @sirlatrom, thanks for this PR! I have a few minor edits and suggestions inline, and I think some more test coverage is needed.
The testAccAzureRMApiManagementCustomDomain_basic
test looks good, but there is no test that sets any of the custom domains. I'd suggest adding a testAccAzureRMApiManagementCustomDomain_complete
test having at least two types configured, and then a testAccAzureRMApiManagementCustomDomain_update
test which first creates a resource with no domains (basic), then adds some domains (complete) and lastly removes then (back to basic), with import steps in between.
If we can expand the tests and fix up the other edits, this looks great to merge!
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/tests/api_management_custom_domain_resource_test.go
Outdated
Show resolved
Hide resolved
@manicminer I've addressed the code comments but have yet to write a |
Wow, turns out the success I thought I'd had with my first attempt was a false positive, and it really did nothing. I've added several commits and have now verified that it actually does what it is supposed to now. |
@sirlatrom I haven't tested your recent edits, but it makes sense at a glance. When testing it seemed like having at least one domain wasn't required, so I figure it makes sense to be able to have a resource with no domains configured - thus enabling removal of existing configured domains? Given that, it's useful to have a test that configures no domains ("basic"), another that configures some ("complete"), and an "update" test that applies a series of configurations ("basic", then "complete", then "basic") to test that moving from no domains, to some domains, and back to no domains, works as expected. |
@manicminer Thanks for your feedback and patience with this PR. The intention (and current implementation in this PR) with regard to being able to remove existing configured domains is that if you've once created an |
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.
Hi @sirlatrom
Thanks for this, I've noted a few changes / issues below.
Aside from those, was there a reason you chose this as a separate resource over extending the azrure_api_management
resource with an additional Optional
schema for this config? (The custom ID note below wouldn't be needed in that approach)
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/tests/api_management_custom_domain_resource_test.go
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/apimanagement/api_management_custom_domain_resource.go
Outdated
Show resolved
Hide resolved
Yes, the sole purpose is to be able to create an |
…ault entry Signed-off-by: Sune Keller <[email protected]>
- Fix bug in api_management data source where `identity` block not populated - Fix test check funcs and configs for api_management_custom_domain - Wait for API Management Service to become ready before and after updating custom domains
@manicminer |
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.
Thanks @manicminer & @sirlatrom - This LGTM now 👍
Thanks @jackofallops 👍 Latest test results: |
This has been released in version 2.36.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.36.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! |
Closes #3058.
The approach used is to modify the API Management service (corresponding to an
azurerm_api_management
resource) by updating an existing instance. A note is added to the documentation in both that and the new resource telling that you should not configure the custom domains in both resources, as that would likely create conflicts.Semantically, if you delete an
azurerm_api_management_custom_domain
, thehostname_configurations
field will be set to be empty (null) when the API Management service instance is updated. There should not be more than oneazurerm_api_management_custom_domain
resource for anazurerm_api_management
, but I have not found a way to enforce this using the Terraform Provider SDK.Includes: