T101-Study-4Week

가시다님과 스터디를 한지도 5번째 이번엔 테라폼이다. 오늘 블로그를 쓰게된건 중간과제를 설명하기 위해서다. 바로 본론으로 들어간다. 내 GIT 이다 https://github.com/Cloud-Linuxer/T101/tree/main/4week variable "availability_zone" { description = "Seoul region availability zone" type = list default = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c", "ap-northeast-2d"] } variable "subnet_numbers" { type = list default = [10, 20, 30, 40] } variable "az_count" { type = list default = ["A", "B", "C", "D"] } 나의 Variables는 이런식으로 구성되어있다. 모든 타입을 List로 선언하여 사용한다. 5주차에 할 테라폼 의 반복문을 사용하기 위한 형태다. 가장 중요한 부분은 subnet_numbers 부분이다. 10, 20, 30, 40 이 핵심이다. ...

November 12, 2022 · 2 min · 📁 AWS

gcp terraform-3 vpc-nat create

vpc-nat 를 연결하기로 했다. 어젠 subnet 을 만들었고 오늘은 망분리 환경을 구성하기 위해 nat 를 넣었다. main.tf resource "google_compute_subnetwork" "us-central1-subnet" { name = "${local.name_suffix}-us-central1-subnet" ip_cidr_range = "10.2.0.0/16" region = "us-central1" network = "${google_compute_network.vpc.self_link}" } resource "google_compute_router" "us-central1-router" { name = "${local.name_suffix}-us-central1-router" region = google_compute_subnetwork.us-central1-subnet.region network = google_compute_network.vpc.self_link } resource "google_compute_address" "address" { count = 2 name = "${local.name_suffix}-nat-manual-ip-${count.index}" region = google_compute_subnetwork.us-central1-subnet.region } resource "google_compute_router_nat" "nat_manual" { name = "${local.name_suffix}-us-central1-router-nat" router = google_compute_router.us-central1-router.name region = google_compute_router.us-central1-router.region nat_ip_allocate_option = "MANUAL_ONLY" nat_ips = google_compute_address.address.*.self_link ...

January 5, 2020 · 1 min · 📁 GCP · 🏷️ gcp, terraform, nat

gcp-terrafrom-2 with VPC create

이전 포스팅에서 cloud shell 을 이용해서 terraform 을 사용하는 방법을 포스팅 했다. 이번에는 VPC 를 생성하는 방법을 포스팅 하기로 하였다. https://www.terraform.io/docs/providers/google/r/compute_subnetwork.html 다음 docs 를 참고하였다. resource name -실제 vpc name -에 대문자가 들어가면 Error: Error creating Network: googleapi: Error 400: Invalid value for field 'resource.name' 에러가 발생한다 참고하자. 이걸 몰라서 한참..테스트를 했다. main.tf resource "google_compute_subnetwork" "us-central1-subnet" { name = "${local.name_suffix}-us-central1-subnet" ip_cidr_range = "10.2.0.0/16" region = "us-central1" network = google_compute_network.linuxer-VPC.self_link } resource "google_compute_subnetwork" "europe-west1-subnet" { name = "${local.name_suffix}-europe-west1-subnet" ip_cidr_range = "10.3.0.0/16" region = "europe-west1" network = google_compute_network.linuxer-VPC.self_link } resource "google_compute_network" "linuxer-VPC" { name = "${local.name_suffix}-vpc" auto_create_subnetworks = false } ...

January 4, 2020 · 2 min · 📁 GCP

gcp-terrafrom-1 with google cloud shell

gcp 스터디를 위해서 테라폼의 사용을 익히려고 한다. 그러기 위해선 먼저 테라폼을 gcp cloudshell 에서 사용하는것이 우선이라 생각했다. 테라폼으로 aws내 에선 테스트 경험이 있으므로 gcp 의 네트워크 구성과 환경에 맞춰서 테라폼을 설정하는 방법을 익혀야 했다. gcp 에서 테라폼을 사용하려면 cloudshell 을 사용하는 방법과 인스턴스를 생성하여 사용하는 방법 아니면 클라이언트 PC에서 사용하는 방법 이렇게 3가지가 있는데 나는 cloudshell 을 매우 좋아하므로 cloudshell 로 진행 할것이다. 먼저 cloud shell 에서 테라폼을 사용하려면 몇가지 단계를 거쳐야 했다. ...

January 4, 2020 · 3 min · 📁 GCP · 🏷️ gcp, cloudshell, terraform