I am trying to get the id
of the default
security group created when creating a vpc using terraform
.
Here's what I tried:
data "aws_default_security_group" "default" {
vpc_id = module.ecs_vpc.vpc_id
}
but I am getting this error:
The provider provider.aws does not support data source "aws_default_security_group"
can someone help me on this?
To get default security group you just use aws_security_group
:
data "aws_security_group" "default" {
name = "default"
vpc_id = module.ecs_vpc.vpc_id
}
Alternatively, you want to manage default group using TF, you can get it using (not data
):
resource "aws_default_security_group" "default" {
vpc_id = data.aws_vpc.default.id
}
``