Skip to content

Commit

Permalink
azurerm_container_app: add support for termination_grace_period_secon…
Browse files Browse the repository at this point in the history
…ds in data source (#28525)
  • Loading branch information
jiaweitao001 authored Jan 16, 2025
1 parent a0fd138 commit f049d8d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions internal/services/containerapps/helpers/container_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ func ContainerTemplateSchema() *pluginsdk.Schema {
"termination_grace_period_seconds": {
Type: pluginsdk.TypeInt,
Optional: true,
Default: 0,
ValidateFunc: validation.IntBetween(0, 600),
Description: "The time in seconds after the container is sent the termination signal before the process if forcibly killed.",
},
Expand Down Expand Up @@ -917,6 +918,11 @@ func ContainerTemplateSchemaComputed() *pluginsdk.Schema {
Type: pluginsdk.TypeString,
Computed: true,
},

"termination_grace_period_seconds": {
Type: pluginsdk.TypeInt,
Computed: true,
},
},
},
}
Expand All @@ -929,10 +935,9 @@ func ExpandContainerAppTemplate(input []ContainerTemplate, metadata sdk.Resource

config := input[0]
template := &containerapps.Template{
Containers: expandContainerAppContainers(config.Containers),
InitContainers: expandInitContainerAppContainers(config.InitContainers),
Volumes: expandContainerAppVolumes(config.Volumes),
TerminationGracePeriodSeconds: pointer.To(config.TerminationGracePeriod),
Containers: expandContainerAppContainers(config.Containers),
InitContainers: expandInitContainerAppContainers(config.InitContainers),
Volumes: expandContainerAppVolumes(config.Volumes),
}

if config.MaxReplicas != 0 {
Expand All @@ -942,6 +947,10 @@ func ExpandContainerAppTemplate(input []ContainerTemplate, metadata sdk.Resource
template.Scale.MaxReplicas = pointer.To(config.MaxReplicas)
}

if config.TerminationGracePeriod != 0 {
template.TerminationGracePeriodSeconds = pointer.To(config.TerminationGracePeriod)
}

if config.MinReplicas != 0 {
if template.Scale == nil {
template.Scale = &containerapps.Scale{}
Expand Down

0 comments on commit f049d8d

Please sign in to comment.