Open matei-dragu opened 2 years ago
Hi @ceresdarkmatter
I don't use ECS + EC2 but the Networking settings only apply for that and not Fargate. With Fargate this option is not available.
I guess with ECS + EC2 the wizard asks for those options so it can create an autoscaling group with the right settings whereas in Terraform these are all separate resources and you have to create all the supporting resources yourself.
In Terraform this would be done like this:-
aws_ecs_cluster - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster aws_ecs_capacity_provider - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_capacity_provider aws_ecs_cluster_capacity_providers - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster_capacity_providers aws_autoscaling_group - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group - it is here where you would specify the network settings not on the ECS cluster resource.
There may be some more resources required, as I said above I don't use ECS + EC2 as I use Fargate (it's really cool :) ) but hope this helps.
Perhaps @trevorrea explanation could be added to the documentation to avoid confusion?
Feel free to open an MR :) though it's all in the AWS docs.
To make it slightly clearer an autoscaling group with vpc_zone_identifier could be added to the example at https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster#example-with-capacity-providers
Community Note
Description
When creating a
aws_ecs_cluster
resource you cannot specify the VPC/Subnets to use.This behavious is happening in version
4.10.0
of the AWS provider.New or Affected Resource(s)
Potential Terraform Configuration
References
Basically the config options in the
Networking
section are missing: