-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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_container_app - Allow multiple custom_domain blocks within the ingress block #20842
Conversation
…ck-docs azurerm_container_app - Add documentation for custom domain block within the ingress block
* add tests for custom domain blocks and update test certificate with SAN * Remove maxItems restriction for custom domain block * Fix custom domain test steps --------- Co-authored-by: Jobin Rufus <Jobin.Rufus@tesco.com>
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.
Hey @srjobinar, this change looks good though the test you've made is failing. Once that's fixed up, we can merge this in
=== CONT TestAccContainerAppResource_basicWithCustomDomains
testcase.go:110: Step 1/2 error: Error running apply: exit status 1
Error: creating Container App (Subscription: "*******"
Resource Group Name: "acctestRG-CAEnv-230308223112188763"
Container App Name: "acctest-capp-230308223112188763"): performing CreateOrUpdate: containerapps.ContainerAppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="InvalidCustomHostNameValidation" Message="A TXT record pointing from asuid.acceptancetest.contoso.com to 633CA537530783A9D6C4F655280B4FACA5D10CD906F227C70F7B5C7DD73DE026 was not found."
with azurerm_container_app.test,
on terraform_plugin_test.tf line 48, in resource "azurerm_container_app" "test":
48: resource "azurerm_container_app" "test" {
creating Container App (Subscription: "*******"
Resource Group Name: "acctestRG-CAEnv-230308223112188763"
Container App Name: "acctest-capp-230308223112188763"): performing
CreateOrUpdate: containerapps.ContainerAppsClient#CreateOrUpdate: Failure
sending request: StatusCode=0 -- Original Error:
Code="InvalidCustomHostNameValidation" Message="A TXT record pointing from
asuid.acceptancetest.contoso.com to
633CA537530783A9D6C4F655280B4FACA5D10CD906F227C70F7B5C7DD73DE026 was not
found."
--- FAIL: TestAccContainerAppResource_basicWithCustomDomains (1918.67s)
Hey @mbfrahry, thanks for checking this out. Was wondering if this error occurs only for a managedEnv which is NOT within a VNet. Additionally I can see that there is already an issue open with Microsoft for the same problem: |
Is this a bugfix or is this a newly added feature since the current documentation states: However, upon trying to apply this configuration we get an error:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
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 @srjobinar
Thanks for this PR. It looks mostly good to me, but we'll need you to remove the changed binary file (testacc.pfx) from the PR please, and I'll get the tests run and a final review completed.
Thanks!
@jackofallops |
@@ -221,7 +221,6 @@ func ContainerAppIngressCustomDomainSchema() *pluginsdk.Schema { | |||
return &pluginsdk.Schema{ | |||
Type: pluginsdk.TypeList, | |||
Optional: true, | |||
MaxItems: 1, |
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.
Based on the documentation, instead of removing the line, it looks like it might have been a typo. Should this be MinItems : 1,
based on the documentation stating:
One or more custom_domain block as detailed below.
Hi @srjobinar - After re-review, this does indeed have a circular dependency as the value for If it helps, I think the new resource would look something like: resource "azurerm_container_app_custom_domain" "example" {
name = "my-custom-host.mydomain.net"
container_app_id = azurerm_container_app.example.id
container_app_environment_certificate_id = azurerm_container_app_environment_certificate.example.id
custom_domain_verification_record_id = azurerm_dns_txt_record.example.id
} There may need to be some additional consideration for cases where the DNS record isn't in Azure DNS? |
Hey @jackofallops I believe creating a new resource from scratch would be a bit hard for me considering my very limited experience in golang and other deliverables I have. Please do go ahead with the change :) Just one point for you to consider maybe:
Might be worth for you to check this as well. I'll try and find some time to redo the above step using azurerm resource, which should give me more clarity on which one of the above is true |
Hi @srjobinar - Within a Vnet, I suspect the DNS checks are skipped due to it being in local addressing? (I'd have to test this to be sure) Without a VNet, the domain must be considered public, and therefore checking DNS ownership via the validation TXT record is necessary. This limitation is not unique to AzureRM, az-api will have the same constraint / failure without a Vnet as the Whilst we could update the resource to allow for multiple custom domains in the existing resource, we'd only be catering for the "bring your own vnet" case, so we would need to still implement the additional association resource for users that do not. At that point, it makes more sense to have a single implementation which caters for both scenarios? WDYT? |
Yeah that makes sense, have confirmed the same in my tests. Just for clarity it was working with azapi in my case as the resource was created without ingress first in which the DNS record was configured via terraform. Ingress was added in subsequent runs.
Just wondering since custom domain is a configuration within the ingress block, should this be a separate resource for ingress resource itself or just the custom domain?
Yeah I agree, would not be ideal to have to do things differently for with/without the Vnet. |
What is the status of this? Why exactly is this waiting response? I'm not exactly sure what the problem here is. So IF you expose the customDomainVerificationId then domains can be provisioned with the correct records before provisioning the app. No need (yet) for an extra resource. |
Would love to see this merged! Much needed |
Hi all - so by way of update on this long outstanding PR. It's waiting response as the resource has a circular reference since it requires that the Based on this, I think this actually needs be considered for a virtual resource and the inline item should be removed (or at least become Due to the above I'm going to close this PR out for the time being and I'll add a note directly to the related issue to the same effect. |
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. |
According to the azurerm_container_app documentation multiple custom domain blocks are allowed in the ingress block.
Currently terraform plan validation fails when multiple blocks are configured.
The following changes are made:
acceptancetest.contoso.net
and SANacceptancetest.contoso.net
fixes #20784