-
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 and Data Source: container_app_environment_managed_certificate
#28366
base: main
Are you sure you want to change the base?
Conversation
ManagedEnvironmentId string `tfschema:"container_app_environment_id"` | ||
DomainControlValidation string `tfschema:"domain_control_validation_type"` | ||
SubjectName string `tfschema:"subject_name"` | ||
Tags map[string]interface{} `tfschema:"tags"` |
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.
Tags map[string]interface{} `tfschema:"tags"` | |
Tags map[string]string `tfschema:"tags"` |
|
||
type ContainerAppEnvironmentManagedCertificateModel struct { | ||
Name string `tfschema:"name"` | ||
ManagedEnvironmentId string `tfschema:"container_app_environment_id"` |
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.
Could we rename this to
ManagedEnvironmentId string `tfschema:"container_app_environment_id"` | |
ContainerAppEnvironmentId string `tfschema:"container_app_environment_id"` |
|
||
managedEnvironment, err := managedEnvironmentsClient.Get(ctx, *managedEnvironmentId) | ||
if err != nil { | ||
return fmt.Errorf("reading %s: %+v", *managedEnvironmentId, err) |
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.
return fmt.Errorf("reading %s: %+v", *managedEnvironmentId, err) | |
return fmt.Errorf("retrieving %s: %+v", *managedEnvironmentId, err) |
return fmt.Errorf("reading %s: %+v", *managedEnvironmentId, err) | ||
} | ||
|
||
managedCertId := managedenvironments.NewManagedCertificateID(metadata.Client.Account.SubscriptionId, managedEnvironmentId.ResourceGroupName, managedEnvironmentId.ManagedEnvironmentName, cert.Name) |
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.
managedCertId := managedenvironments.NewManagedCertificateID(metadata.Client.Account.SubscriptionId, managedEnvironmentId.ResourceGroupName, managedEnvironmentId.ManagedEnvironmentName, cert.Name) | |
managedCertId := managedenvironments.NewManagedCertificateID(managedEnvironmentId.SubscriptionId, managedEnvironmentId.ResourceGroupName, managedEnvironmentId.ManagedEnvironmentName, cert.Name) |
Location: managedEnvironment.Model.Location, | ||
Name: pointer.To(managedCertId.ManagedCertificateName), | ||
Properties: &managedenvironments.ManagedCertificateProperties{ | ||
DomainControlValidation: &domainControlValidation, |
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.
DomainControlValidation: &domainControlValidation, | |
DomainControlValidation: pointer.To(managedenvironments.ManagedCertificateDomainControlValidation(cert.DomainControlValidation)), |
} | ||
|
||
func (r ContainerAppEnvironmentManagedCertificateResource) requiresImport(data acceptance.TestData) string { | ||
template := r.basic(data) |
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.
template := r.basic(data) |
|
||
type ContainerAppEnvironmentManagedCertificateDataSourceModel struct { | ||
Name string `tfschema:"name"` | ||
ManagedEnvironmentId string `tfschema:"container_app_environment_id"` |
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.
ManagedEnvironmentId string `tfschema:"container_app_environment_id"` | |
ContainerAppEnvironmentId string `tfschema:"container_app_environment_id"` |
// Read Only | ||
SubjectName string `tfschema:"subject_name"` | ||
DomainControlValidation string `tfschema:"domain_control_validation_type"` | ||
Tags map[string]interface{} `tfschema:"tags"` |
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.
Tags map[string]interface{} `tfschema:"tags"` | |
Tags map[string]string `tfschema:"tags"` |
if response.WasNotFound(existing.HttpResponse) { | ||
return fmt.Errorf("%s was not found", id) | ||
} | ||
return fmt.Errorf("reading %s: %+v", id, err) |
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.
return fmt.Errorf("reading %s: %+v", id, err) | |
return fmt.Errorf("retrieving %s: %+v", id, err) |
cert.ManagedEnvironmentId = envId.ID() | ||
|
||
if model := existing.Model; model != nil { | ||
cert.Tags = tags.Flatten(model.Tags) |
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.
cert.Tags = tags.Flatten(model.Tags) | |
cert.Tags = pointer.From(model.Tags) |
* `create` - (Defaults to 30 minutes) Used when creating the Container App Environment Managed Certificate. | ||
* `update` - (Defaults to 30 minutes) Used when updating the Container App Environment Managed Certificate. | ||
* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Managed Certificate. | ||
* `delete` - (Defaults to 30 minutes) Used when deleting the Container App Environment Managed Certificate. |
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.
* `create` - (Defaults to 30 minutes) Used when creating the Container App Environment Managed Certificate. | |
* `update` - (Defaults to 30 minutes) Used when updating the Container App Environment Managed Certificate. | |
* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Managed Certificate. | |
* `delete` - (Defaults to 30 minutes) Used when deleting the Container App Environment Managed Certificate. | |
* `create` - (Defaults to 30 minutes) Used when creating the Container App Environment Managed Certificate. | |
* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Managed Certificate. | |
* `update` - (Defaults to 30 minutes) Used when updating the Container App Environment Managed Certificate. | |
* `delete` - (Defaults to 30 minutes) Used when deleting the Container App Environment Managed Certificate. |
Community Note
Description
Add new data source and resource –
container_app_environment_managed_certificate
.According to a comment here, a new bindingType option
bindingType: 'auto'
will be introduced to thecustomDomains
property of thecontainerApp
resource starting in mid-January 2025. This update will simplify the process by eliminating the current two-step approach, where both a binding and a managed certificate need to be created in specific order. With this change, only the managed certificate will need to be created. This PR adds the managed certificate resource to support this scenario.PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
container_app_environment_managed_certificate
container_app_environment_managed_certificate
This is a (please select all that apply):
Related Issue(s)
Fixes #21866
Note
If this PR changes meaningfully during the course of review please update the title and description as required.