Please consult the examples
directory for reference example configurations. If you find a bug, please open an issue with supporting configuration to reproduce.
- Minimum supported version of Terraform AWS provider updated to v4.6 to support the latest resources utilized
- Minimum supported version of Terraform updated to v1.0
ecs-instance-profile
sub-module has been removed; this functionality is available through theterraform-aws-modules/terraform-aws-autoscaling
module starting with version v6.5.0. Please see theexamples/complete
example for a demonstration on how to use and integrate with theterraform-aws-autoscaling
module.- The
container_insights
andcapacity_providers
variables have been replaced by new variables - see below for more details
- Support for
aws_ecs_capacity_provider
has been added to the module
- The
container_insights
variable has been replaced with thecluster_settings
variable which allows users to enable/disable container insights and also allows for not specifying at all for regions where container insights is currently not supported. - The
capacity_providers
variable has been replaced withfargate_capacity_providers
andautoscaling_capacity_providers
. This allows users to specify either Fargate based capacity providers, EC2 AutoScaling Group capacity providers, or both. - Previously
capacity_providers
anddefault_capacity_provider_strategy
usage looked like:
capacity_providers = ["FARGATE", "FARGATE_SPOT"]
default_capacity_provider_strategy = [{
capacity_provider = "FARGATE"
weight = 50
base = 20
}, {
capacity_provider = "FARGATE_SPOT"
weight = 50
}]
Where the current equivalent now looks like:
fargate_capacity_providers = {
FARGATE = {
default_capacity_provider_strategy = {
weight = 50
base = 20
}
}
FARGATE_SPOT = {
default_capacity_provider_strategy = {
weight = 50
}
}
}
- Previously
capacity_providers
accepted the name of an AutoScaling Group created externally; this is now replaced by the usage ofautoscaling_capacity_providers
which incorporates the usage of the newly added support foraws_ecs_capacity_provider
ecs-instance-profile
sub-module has been removed; this functionality is available through theterraform-aws-modules/terraform-aws-autoscaling
module starting with version v6.5.0. Please see theexamples/complete
example for a demonstration on how to use and integrate with theterraform-aws-autoscaling
module.
-
Removed variables:
default_capacity_provider_strategy
is now incorporated into thefargate_capacity_providers
andautoscaling_capacity_providers
variables.
-
Renamed variables:
create_ecs
->create
name
->cluster_name
-
Added variables:
cluster_configuration
has been added under a dynamic block with all current attributes supported
-
Removed outputs:
ecs_cluster_name
-
Renamed outputs:
ecs_cluster_id
->cluster_id
ecs_cluster_arn
->cluster_arn
-
Added outputs:
cluster_capacity_providers
autoscaling_capacity_providers
module "ecs" {
source = "terraform-aws-modules/ecs/aws"
version = "3.5.0"
name = "example"
container_insights = true
capacity_providers = ["FARGATE", "FARGATE_SPOT", aws_ecs_capacity_provider.prov1.name]
default_capacity_provider_strategy = [{
capacity_provider = aws_ecs_capacity_provider.prov1.name
weight = "1"
}]
}
module "ec2_profile" {
source = "terraform-aws-modules/ecs/aws//modules/ecs-instance-profile"
version = "3.5.0"
name = local.name
}
resource "aws_ecs_capacity_provider" "prov1" {
name = "prov1"
auto_scaling_group_provider {
auto_scaling_group_arn = module.autoscaling.autoscaling_group_arn
}
}
module "ecs" {
source = "terraform-aws-modules/ecs/aws"
version = "4.0.0"
cluster_name = "example"
fargate_capacity_providers = {
FARGATE = {}
FARGATE_SPOT = {}
}
autoscaling_capacity_providers = {
prov1 = {
auto_scaling_group_arn = module.autoscaling.autoscaling_group_arn
default_capacity_provider_strategy = {
weight = 1
}
}
}
}
module "ec2_profile" {
source = "terraform-aws-modules/ecs/aws//modules/ecs-instance-profile"
# Users can pin and stay on v3.5.0 until they able to use the IAM instance
# profile provided through the autoscaling group module
version = "3.5.0"
name = "example
}
- resource "aws_ecs_capacity_provider" "prov1" {
- name = "prov1"
-
- auto_scaling_group_provider {
- auto_scaling_group_arn = module.autoscaling.autoscaling_group_arn
- }
- }
module "ecs" {
source = "terraform-aws-modules/ecs/aws"
- version = "3.5.0"
+ version = "4.0.0"
- name = "example"
+ cluster_name = "example"
- container_insights = true
+ # On by default now
- capacity_providers = ["FARGATE", "FARGATE_SPOT", aws_ecs_capacity_provider.prov1.name]
- default_capacity_provider_strategy = [{
- capacity_provider = aws_ecs_capacity_provider.prov1.name
- weight = "1"
- }]
+ fargate_capacity_providers = {
+ FARGATE = {}
+ FARGATE_SPOT = {}
+ }
+ autoscaling_capacity_providers = {
+ prov1 = {
+ auto_scaling_group_arn = module.autoscaling.autoscaling_group_arn
+ default_capacity_provider_strategy = {
+ weight = 1
+ }
+ }
+ }
}
In conjunction with the changes above, users can elect to move their external capacity provider(s) under this module using the following move command. Command is shown using the values from the example shown above, please update to suit your configuration names:
# Cluster
terraform state mv 'aws_ecs_capacity_provider.prov1' 'module.ecs.aws_ecs_capacity_provider.this["prov1"]'