1
https://docs.nhncloud.com/ko/Compute/Instance/ko/terraform-guide/
vpc 참고
https://docs.nhncloud.com/ko/Compute/Instance/ko/terraform-guide/#vpc_2
2
VPC 1
Pubsubnet 1
sudo su -
cd terraform_root/environment/dev
# pro.tf
# Define required providers
terraform {
required_version = ">= 1.0.0"
required_providers {
nhncloud = {
source = "nhn-cloud/nhncloud"
version = "1.0.2"
}
}
}
provider "nhncloud" {
user_name = var.nhncloud_info["user_name"]
tenant_id = var.nhncloud_info["tenant_id"]
password = var.passwd
auth_url = var.nhncloud_info["auth_url"]
region = var.region["kr2"]
}
--------------
#vpc .tf
resource "nhncloud_networking_vpc_v2" "terrform_vpc"{
name="tf-vpc-01"
cidrv4="10.0.0.0/16"
}
#subnet
resource "nhncloud_networking_vpcsubnet_v2" "terrform_v-vpcsubnet-01" {
name="public-subnet"
vpc_id= nhncloud_networking_vpc_v2.terrform_vpc.id
cidr="10.0.1.0/24"
}
-----------------
# var.tf
variable nhncloud_info {
type =map(string)
default = {
user_name = "topasvga@naver.com"
tenant_id = "0ccc9863d32d7cf43"
password = "test"
auth_url = "https://api-identity-infrastructure.nhncloudservice.com/v2.0"
}
}
variable passwd {
type = string
default = "test"
sensitive =true
}
variable region {
type = map(string)
default = {
kr1 = "KR1"
kr2 = "KR2"
}
}
3
VPC 1
Pubsubnet 1
Privatesubnet 1
private routing table 1
network.tf
#VPC 생성 리소스 블록
resource "nhncloud_networking_vpc_v2" "terraform_vpc" {
name = "terraform_vpc"
cidrv4 = "10.0.0.0/16"
}
resource "nhncloud_networking_vpcsubnet_v2" "public_subnet" {
name = "public_subnet"
vpc_id = nhncloud_networking_vpc_v2.terraform_vpc.id
cidr = "10.0.1.0/24"
}
resource "nhncloud_networking_vpcsubnet_v2" "private_subnet" {
name = "private_subnet"
vpc_id = nhncloud_networking_vpc_v2.terraform_vpc.id
cidr = "10.0.2.0/24"
}
resource "nhncloud_networking_routingtable_v2" "private_rt" {
name = "private_rt"
vpc_id = nhncloud_networking_vpc_v2.terraform_vpc.id
}
4
# 콘솔로 IGW 생성
# Routing에서 IGW연결
# 인터넷 게이트웨이는 콘솔로
# 쿠버네티스 예정
다음
https://brunch.co.kr/@topasvga/4588