# (Optional) 멀티 VPC 구성

## Production 환경 구성

* Production 환경은 위의 파일 세팅과 동일하게 진행하여 생성하시면 됩니다.
* `backend.tf` 와  `terraform.tfvars` 에 있는 값만 Production에 맞게 변경해주시면 됩니다.

### :rocket: 운영환경용 폴더 생성

* 앞에서 생성한 `devartd_apnortheast2` 폴더를 통째로 복사합니다. 그리고, `.terraform` 에 상태값이 저장되기 때문에, 삭제하고 다시&#x20;

```bash
$ cp -R devartd_apnortheast2 devartp_apnortheast2
$ cd devartp_apnortheast2
$ rm -rf .terraform*
```

###

### :rocket: 변수값 변경

`backend.tf`에서 저장될 버킷 이름을 변경합니다. **다만, 본 실습에서는 같은 계정으로 진행하므로 변경은 생략합니다.**

{% code title="backend.tf" %}

```hcl
terraform {
  required_version = ">= 1.5.7"

  backend "s3" {
    bucket         = "devart-preprod-apnortheast2-tfstate"
    key            = "devart/terraform/vpc/devartp_apnortheast2/terraform.tfstate"
    region         = "ap-northeast-2"
    encrypt        = true
    dynamodb_table = "terraform-lock"
  }
}
```

{% endcode %}

`terraform.tfvars` 에 실제 변수값을 변경합니다.

{% code title="terraform.tfvars" %}

```hcl
aws_region   = "ap-northeast-2"
cidr_numeral = "11"

# Please change "devart" to what you want to use
# d after name indicates develop. This means that devartd_apnortheast2 VPC is for development environment VPC in Seoul Region.
vpc_name = "devartp_apnortheast2"

# Billing tag in this VPC
billing_tag = "prod"

# Availability Zone list
availability_zones = ["ap-northeast-2a", "ap-northeast-2c"]

# In Seoul Region, some resources are not supported in ap-northeast-2b
availability_zones_without_b = ["ap-northeast-2a", "ap-northeast-2c"]

# shard_id will be used later when creating other resources.
# With shard_id, you could distinguish which environment the resource belongs to
shard_id       = "devartpapne2"
shard_short_id = "devart01p"

# d means develop
env_suffix = "p"

# VPC Peering Connection Variables
# vpc_peer_connection_id_devartp_apne2 = "pcx-"
# devartp_destination_cidr_block       = "10.20.0.0/16"
```

{% endcode %}

###

### 리소스 생성

Terraform plan / apply 를 통해서 리소스를 생성합니다. 과정은 위와 동일하므로 생략합니다.

만약, account가 다른 경우에는 해당 Account로 assume을 다시 하셔야 합니다.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://terraform201.devart.tv/1.-vpc/optional-vpc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
