EMD Blog

tfe_variable Resource value Type 관련 본문

IaC/Terraform

tfe_variable Resource value Type 관련

EmaDam 2022. 9. 4. 07:52

tfe_variable Resource를 사용해서 Terraform Workspace의 변수를 관리 할 수 있음. 하지만 이 variable Resource의 value로는 String만 지정이 가능함. 만약에 Map, List 등을 지정 할 경우 아래 에러가 발생

tfe_variable Inappropriate value for attribute "value": string required.

관련 이슈는 아래에서 확인 가능하며 해결방법도 나와있음.(jsonencode )

https://github.com/hashicorp/terraform-provider-tfe/issues/188

 

tfe_variable: list(string) not supported · Issue #188 · hashicorp/terraform-provider-tfe

It seems like tfe_variable does not support values where the type is list(string) on tfe_workspace_vars.tf line 24, in resource "tfe_variable" "subnet_ids": 24: value = [for sub...

github.com

위에서 jsonencode한 변수는 실제 사용전에 로컬 변수로 선언 후 jsondecoe 후 사용해주면 된다. 관련 내용은 아래 내용 참고.

https://www.terraform.io/language/functions/jsonencode

https://www.terraform.io/language/functions/jsondecode