Data Source: aws_security_groups#
Provides information about IDs and VPC membership of security groups.
Example Usage#
data "aws_security_groups" "test" {
tags = {
Application = "k8s"
Environment = "dev"
}
}
variable vpc_id {}
data "aws_security_groups" "test" {
filter {
name = "group-name"
values = ["nodes"]
}
filter {
name = "vpc-id"
values = [var.vpc_id]
}
}
Argument Reference#
tags
- (Optional) Map of tags, each pair of which must exactly match for desired security groups.filter
- (Optional) One or more name/value pairs to use as filters.- Valid values: See supported names and values in EC2 API documentation
Attribute Reference#
In addition to all arguments above, the following attributes are exported:
arns
- The Amazon Resource Names (ARNs) of the matched security groups.id
- The region.ids
- IDs of the matched security groups.vpc_ids
- The VPC IDs of the matched security groups. The data source's tag or filter will span VPCs unless thevpc-id
filter is also used.