inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스스로 구축하는 AWS 클라우드 인프라 with 테라폼(Terraform) - 기본편

security-group 생성 중 오류가 나서 질문을 드립니다.

324

alsyean

작성한 질문수 1

0

테라폼 버전은 1.0.6 이고 aws 버전은 3.5.8을 이용하여 실습을 따라하고 있습니다.
 
현재 Security-group을 생성 하는 실습을 하고 있는데 tf plan 명령어를 입력하면
 
Inappropriate value for attribute "ingress": element 0: attributes "prefix_list_ids", "security_groups", and "self" are required.
 
Inappropriate value for attribute "egress": element 0: attributes "prefix_list_ids", "security_groups", and "self" are required.
 
이 2가지 문구가 나오면 오류가 표시 됩니다.
 
알려주신 registry.terraform.io 에서도 "prefix_list_ids", "security_groups","self"는 선택 사항이라고 나오는데 오류 문구는 필수라고 나오는데 버전 다운을 하지 않고 해결 할 수 있는 법이 있을까요??
 
아래는 오류 메시지랑 버전 이미지입니다.
 

aws 서버리스 Terraform

답변 1

0

노마드 콘텐츠 랩

안녕하세요. alsyean님, 강의 들어주셔서 감사합니다.

질문 내용에 대해 답변드리겠습니다.

 

Terraform 버전 v1.0.4, v1.0.7 2개의 버전으로 Terraform 의 Security Group 테스트를 해보았습니다.

결과적으로 terraform plan 실행 시에 2개의 Terraform 버전 동일하고 아래와 같이 정상 결과가 나왔습니다. 

 

# aws_security_group.allow_web will be created

  + resource "aws_security_group" "allow_web" {

      + arn                    = (known after apply)

      + description            = "Allow web inbound traffic"

      + egress                 = [

          + {

              + cidr_blocks      = [

                  + "0.0.0.0/0",

                ]

              + description      = ""

              + from_port        = 0

              + ipv6_cidr_blocks = []

              + prefix_list_ids  = []

              + protocol         = "-1"

              + security_groups  = []

              + self             = false

              + to_port          = 0

            },

        ]

      + id                     = (known after apply)

      + ingress                = [

          + {

              + cidr_blocks      = [

                  + "0.0.0.0/0",

                ]

              + description      = "web from VPC"

              + from_port        = 0

              + ipv6_cidr_blocks = []

              + prefix_list_ids  = []

              + protocol         = "-1"

              + security_groups  = []

              + self             = false

              + to_port          = 0

            },

        ]

      + name                   = "allow_web"

      + name_prefix            = (known after apply)

      + owner_id               = (known after apply)

      + revoke_rules_on_delete = false

      + tags                   = {

          + "Name" = "allow_web"

        }

      + tags_all               = {

          + "Name" = "allow_web"

        }

      + vpc_id                 = "vpc-0707d523c3a075ee0"

    }

 

Plan: 3 to add, 0 to change, 0 to destroy.

 

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

 

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you

run "terraform apply" now.

 

강의에 나오는 테스트 Security Group 예제를 공유 드립니다.

resource "aws_security_group" "allow_web" {

  name        = "allow_web"

  description = "Allow web inbound traffic"

  vpc_id      = var.vpc_id

 

  ingress {

    description = "web from VPC"

    from_port   = 0

    to_port     = 0

    protocol    = "-1"

    cidr_blocks = ["0.0.0.0/0"]

  }

 

  egress {

    from_port   = 0

    to_port     = 0

    protocol    = "-1"

    cidr_blocks = ["0.0.0.0/0"]

  }

 

  tags = {

    Name = "allow_web"

  }

}

 

보안그룹 아웃바운드 규칙

0

6

1

twitterdb 연결이 안돼요

1

24

2

rdb 만들 때 인스턴스 구성시 인스턴스 유형에 활성화 되는 것이 없습니다.

0

15

1

데이터베이스 13번 문제

0

27

2

macOS에서 Windows 실행하는 프로그램

1

19

2

수업기간 연장 부탁드립니다.

0

48

2

6번 질문

0

52

2

강의 자료

1

38

2

현재 시점 기준으로 최신 시험 출제 범위가 반영되었다고보면 될까요?

0

53

2

AWS 네트워크 강의 듣다가 테라폼 강의 결제했는데 동일한 분이 강의하시는거 맞나요?

0

284

1

id / ids / arn / name 등 뒤에 붙이는 기준이 궁금합니다.

0

300

1

ws_autoscaling_group에서 initial_lifecycle_hook 에 대해 추가 설명 부탁드립니다

0

198

1

alb attachment vs asg attachment

0

285

1

ec2.tf를 복사할 때 provider.tf를 별도 생성하는 방향으로 안내해주심이 어떨지

0

237

1

userdata용 리소스 https://bit.ly/Userdata

0

185

1

Error: Reference to undeclared resource

0

713

1

aws_subnet_ids 가 deprecated 예정이라고 합니다.

0

409

1

ec2.tf 실습시 VPC, subnet를 먼저 만들고 진행하는 것이 좋을 것 같습니다

0

213

1

복수개 key pair를 ec2 instance에 적용하는 방법

0

357

1

강의 내용 중 문의 내용이 있어 확인 부탁드립니다.

0

230

1

Terraform으로 Virtual Private Cloud(VPC) 구성 질문입니다.

0

239

1

Quick Start AMI 찾기가 없습니다.

0

376

1

대괄호[]의 의미

0

315

1

강의에서 사용된 tf 파일들은 어떻게 다운 받을 수 없나요?

0

266

1