상세 컨텐츠

본문 제목

[VScode] local에서 Terraform vpc 생성

Terraform

by yukmim 2022. 7. 28. 17:19

본문

<window에서 terraform을 사용하기 위한 환경설정>

https://majjangjjang.tistory.com/164

 

[Terraform] WSL2 + cloud sdk + terraform + VScode 개발환경 구축

0. 들어가기전 윈도우 환경에서 GCP에 Terraform을 이용하여 배포하기 위해 환경을 구축하는 것이 목표 WSL에 Cloud SDK, terraform을 설치하여 VSCode에 연동 1. Window Terminal Install [시작] - [Microsoft St..

majjangjjang.tistory.com

 

<aws.tf>

provider "aws" {
  access_key = "YOUR AWS ACCESS KEY"
  secret_key = "YOUR AWS SECRET KEY"
  region     = "ap-northeast-2"
}

<security-group.tf>

resource "aws_security_group" "example-allow-all" {
  name = "example-allow_all"
  description = "Allow all inbound traffic"
  vpc_id = "${aws_vpc.example.id}"

  ingress {
    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"]
  }
}

<vpc.tf>

resource "aws_vpc" "example" {
  cidr_block = "172.10.0.0/20"
  tags = {
    Name = "example"
  }
}

resource "aws_subnet" "example-a" {
  vpc_id = "${aws_vpc.example.id}"
  cidr_block = "172.10.0.0/24"
  availability_zone = "ap-northeast-2a"
}

resource "aws_subnet" "example-c" {
  vpc_id = "${aws_vpc.example.id}"
  cidr_block = "172.10.1.0/24"
  availability_zone = "ap-northeast-2a"
}

$ terrafrom plan

$ terraform apply

'Terraform' 카테고리의 다른 글

git으로 Terraform DDB 생성하기  (0) 2022.07.28
Terraform이란  (0) 2022.07.28

관련글 더보기

댓글 영역