You can use the aws_security_group_rule
described here https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule It has a source_security_group_id
field where you can specify the security group you want to allow traffic from.
Before that you'd probably create the security group with the aws_security_group
resource https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group . And you can the pass the id of this security group in the security_group_id
field of the aws_security_group_rule
resource.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.