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

certificate_id an optional argument of azurerm_container_app resource #24117

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 9 additions & 3 deletions internal/services/containerapps/helpers/container_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ func ContainerAppIngressCustomDomainSchema() *pluginsdk.Schema {

"certificate_id": {
Type: pluginsdk.TypeString,
Required: true,
Optional: true,
ValidateFunc: managedenvironments.ValidateCertificateID,
Description: "The ID of the Certificate. Only to be passed when `certificate_binding_type` is set to `SniEnabled`",
},

"name": {
Expand Down Expand Up @@ -382,12 +383,17 @@ func expandContainerAppIngressCustomDomain(input []CustomDomain) *[]containerapp
result := make([]containerapps.CustomDomain, 0)
for _, v := range input {
customDomain := containerapps.CustomDomain{
Name: v.Name,
CertificateId: pointer.To(v.CertificateId),
Name: v.Name,
}
bindingType := containerapps.BindingType(v.CertBinding)
customDomain.BindingType = &bindingType

// certificate_id is only need for sni domains according to
// https://learn.microsoft.com/en-us/azure/container-apps/custom-domains-certificates
if bindingType == containerapps.BindingTypeSniEnabled {
customDomain.CertificateId = pointer.To(v.CertificateId)
}

result = append(result, customDomain)
}

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/container_app.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ A `custom_domain` block supports the following:

* `certificate_binding_type` - (Optional) The Binding type. Possible values include `Disabled` and `SniEnabled`. Defaults to `Disabled`.

* `certificate_id` - (Required) The ID of the Container App Environment Certificate.
* `certificate_id` - (Optional) The ID of the Container App Environment Certificate. Only to be passed when `certificate_binding_type` is set to `SniEnabled`.

* `name` - (Required) The hostname of the Certificate. Must be the CN or a named SAN in the certificate.

Expand Down
Loading