2017-01-24 24 views

答えて

0

あなたはドキュメントごとに、aws_security_groupリソースごとに複数のingressルールを指定することができます

ingress - (Optional) Can be specified multiple times for each ingress rule.

あなたはについての詳細を読むことができますこのhereはTerraformのドキュメントにあります。

次のようになります両方CIDRとセキュリティグループソースIDを使用しての作業例:

resource "aws_security_group" "security_group" { 
    name = "My security group" 
    vpc_id = "${var.vpc_id}" 

    ingress { 
    from_port = 22 
    to_port  = 22 
    protocol = "tcp" 
    cidr_blocks = ["123.45.76.89/32"] 
    } 

    ingress { 
    from_port  = 22 
    to_port   = 22 
    protocol  = "tcp" 
    security_groups = ["${aws_security_group.some_other_server.id}"] 
    } 

    // .. egress rules 
    // .. tags, etc 
} 

すでに複数のingressのルールを使用している場合、それはあなたのCIDRブロックが単に重複している可能性があります。

関連する問題