This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Allow resource configuration to provide additional state file values #299
Labels
enhancement
New feature or request
What problem are you facing?
I used terrajet to generate Apigee resources from the standard GCP terraform provider. The generation aspect worked as expected, however I was never able to fully get it to work end-to-end.
What ultimately ends up happening is that because the
name
attribute is not an input to the resource, it is excluded from the terraform.tfstate created by terrajet. However, the GCP provider does appear to require thename
attribute to exist in the tfstate.I can verify this by stopping the controller and manually visiting the terraform tmp directory created in the terrajet controller (via the log outputs). To make the commands work I remove the lifecycle prevent_destroy block from the main.tf.json file.
If I manually execute a terraform refresh on the originally created state file, it will back-up the terraform.tfstate and leave a new one that is mostly empty, minus the
id
field and provider information. Aterraform plan
on that state will result in the provider attempting to replace something which doesn't exist.However, if I modify the state file to include a
name
field that is correctly formatted, it correctly determines that it can create the resource.I tried every variation of settings but I could never arrive at a solution that did not also put the
name
field into the module inputs, which is an error as this resource does not support aname
attribute.How could Terrajet help solve your problem?
Right now, terrajet offers the ability to template and render the
id
field for a variety of cases (via the GetIDFn) (docs).If we could extend this behavior to other attributes which will render fully, but only in the statefile and not the resource inputs, it would allow me to work around this issue.
The text was updated successfully, but these errors were encountered: