diff --git a/internal/services/containerapps/helpers/container_apps.go b/internal/services/containerapps/helpers/container_apps.go index 56755711d548..303b24fa98d7 100644 --- a/internal/services/containerapps/helpers/container_apps.go +++ b/internal/services/containerapps/helpers/container_apps.go @@ -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.", }, @@ -917,6 +918,11 @@ func ContainerTemplateSchemaComputed() *pluginsdk.Schema { Type: pluginsdk.TypeString, Computed: true, }, + + "termination_grace_period_seconds": { + Type: pluginsdk.TypeInt, + Computed: true, + }, }, }, } @@ -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 { @@ -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{}