Hong
Hong

Reputation: 23

Why all attributes in the access_config becomes require while the documentation said they are optional?

I am new to Terraform and its CDK. I am confuse about the following:

When I try to run the tf.json generated through cdktf synth using cdktf deploy, terraform plan or terraform apply, the console keeps telling me that all attributes inside the access_config are required and emit errors, but I checked the documentation, it is said that these field can be optional.

So, I want to know is it a bug or the documentation is wrong ?

Upvotes: 1

Views: 89

Answers (3)

Navdeep Duvedi
Navdeep Duvedi

Reputation: 16

The use for access_config is required in terraform cdk in comparison to terraform hcl. In terraform where we use HCL to write the configurations, access_config can be left empty but for terraform cdk is needs to be populated with parameters which can be left empty.

Upvotes: 0

Hong
Hong

Reputation: 23

After discuss with my colleagues, I managed to solve the problem. For the access_config, you have to fill in the attributes while leave them blank if you don't want to give any value to them:

"access_config":[{
    "nat_ip":"google_compute_address.some_name.address",
    "public_ptr_domain_name":"",
    "network_tier":""
}]

Upvotes: 0

Sam
Sam

Reputation: 161

If you are checking the correct version of Terraform documentation and still see in tf plan/apply these attributes as required then you should add these attributes in your config. Might happen that the documentation is not up to date

Upvotes: 1

Related Questions