Terraform module which renders a valid AppSpec file from a aws_ecs_service
and, optionally, stores it in the
SSM Parameter store. Why?
For deployments with CODE_DEPLOY, an AppSpec file with the LoadBalancer info is required. The file is stored in the SSM Parameter Store and can be fetched during the deployment to allow us to change these parameters after the service has already been created. Structure is defined here:
Name | Description | Type | Default | Required |
---|---|---|---|---|
aws_ecs_service | A complete aws_ecs_service resource to extract the inputs from. |
any |
n/a | yes |
description | Description of the SSM Parameter. | string |
null |
no |
enable_ssm_parameter | Create an AWS SSM Parameter for the rendered AppSpec. | bool |
true |
no |
name | Name of the SSM Parameter. | string |
null |
no |
ssm_parameter_format | The output format for rendered AppSpec file to write to SSM. Can be json or yaml . |
string |
"json" |
no |
tags | Tags to add to the SSM Parameter. | map(any) |
{} |
no |
Name | Description |
---|---|
appspec | The AppSpec definition as HCL object. |
appspec_json | The AppSpec definition as JSON string. |
appspec_yaml | The AppSpec definition as YAML string. |
ssm_parameter_arn | The ARN of the SSM parameter containing the AppSpec definition. |
Name | Version |
---|---|
aws | >= 4.36 |
- resource.aws_ssm_parameter.main (main.tf#44)
resource "aws_ecs_service" "example" {
name = "example"
task_definition = "some-task-definition:1"
platform_version = "LATEST"
load_balancer {
container_name = "app"
container_port = 80
}
network_configuration {
subnets = ["subnet-12345678", "subnet-87654321"]
security_groups = ["sg-12345678"]
assign_public_ip = false
}
}
module "example" {
source = "../../"
aws_ecs_service = aws_ecs_service.example
}