1) Provicder.tf 생성
vim provider
"
provider "aws" {
region = "ap-northeast-1"
}
"
2) VPC 생성
vim vpc.tf
"
resource "aws_vpc" "main" {
cidr_block = "ip대역"
tage = {
Name = "vpc-dev-ircp"
}
}
3) terraform init - plan - apply
terraform init
terraform plan
terraform apply
2) Subnet 생성
vim vpc.tf //vpc를 만든 곳에 subnet 코드 작성
"
resource "aws_subent" "sbn-dev-ircp-public-resource-az2a" {
vpc_id = aws_vpc.main.id
cidr_block = "ip대역"
availability_zone = "ap-northeast-1a"
tags = {
Name = "sbn-dev-ircp-public-resource-az2a"
}
}
resource "aws_subent" "sbn-dev-ircp-public-resource-az2c" {
vpc_id = aws_vpc.main.id
cidr_block = "ip대역"
availability_zone = "ap-northeast-1a"
tags = {
Name = "sbn-dev-ircp-public-resource-az2c"
}
}
"
terraform plan
terraform apply
terraform state list
'Cloud Infra Architecture (AWS) > AWS Terraform' 카테고리의 다른 글
VScode에서 Terraform + AWS CodeWhisperer 계정 연결하기 (0) | 2024.06.06 |
---|---|
Terraform IGW, Nat gateway 생성 (0) | 2024.02.04 |
AWS Terraform 락업 (error acquiring the state lock) 해제 (0) | 2024.01.31 |
AWS Terraform Setting (alias 등록, tree 명령어 사용, vim.ts 커스텀) (0) | 2024.01.30 |
AWS Terraform version upgrade 방법 (2) | 2024.01.30 |