기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
Terraform 코드형 인프라(IaC) 파일 파라미터 세부 정보 및 예제
템플릿 번들의 variable.tf
파일에 Terraform 입력 변수를 포함할 수 있습니다. 스키마를 생성하여 관리형 변수를 생성할 AWS Proton 수도 있습니다.는 스키마 파일.tf files
에서 변수를 AWS Proton 생성합니다. 자세한 내용은 Terraform IaC 파일 단원을 참조하십시오.
인프라에서 스키마 정의 AWS Proton 변수를 참조하려면 Terraform IaC 테이블의 파라미터 및 네임스페이스에 AWS Proton 표시된 네임스페이스를 .tf files
사용합니다. IaC 예를 들어 var.environment.inputs.vpc_cidr
를 사용할 수 있습니다. 따옴표 안에 이러한 변수를 대괄호로 묶고 첫 번째 중괄호 앞에 달러 기호를 추가합니다(예: “${var.environment.inputs.vpc_cidr}”
).
다음 예제에서는 네임스페이스를 사용하여 환경에 AWS Proton 파라미터를 포함하는 방법을 보여줍니다.tf file
.
terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 3.0" } } // This tells terraform to store the state file in s3 at the location // s3://terraform-state-bucket/tf-os-sample/terraform.tfstate backend "s3" { bucket = "terraform-state-bucket" key = "tf-os-sample/terraform.tfstate" region = "us-east-1" } } // Configure the AWS Provider provider "aws" { region = "us-east-1" default_tags { tags = var.proton_tags } } resource "aws_ssm_parameter" "my_ssm_parameter" { name = "my_ssm_parameter" type = "String" // Use the Proton environment.inputs. namespace value = var.environment.inputs.ssm_parameter_value }