-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apigee State Rendering with Computed Name Field #12413
Comments
@justin-watkinson-cherre by running below sample, it seems to be fine with the |
I've attached the debug output to this comment: "Bug" is probably too strong a word, but it really comes as a mismatch between the expectations of the two projects. Naturally, when using the standard terraform tooling for creation/import, it works as expected. When terrajet renders a tfstate file, it is ignoring the The reason I looked at it from the gcp provider point of view is I believe |
@justin-watkinson-cherre I am not aware of supporting terrajets is one of the goals for this provider. As you discovered, this resource works as expected. Regarding
https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations |
I see. The only reason I noticed is because it looks like their interface supports the I also placed an enhancement request on their project as well to provide a workaround from when a field other than |
@justin-watkinson-cherre cool. Closing this then. Feel free to reopen if you want to continue the conversation |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
v1.2.8
Affected Resource(s)
google_apigee_organization
Terraform Configuration Files
Debug Output
Panic Output
N/A
Expected Behavior
When the state file does not include the "Name' field, the ID is used to determine if the resource already exists
Actual Behavior
When the terraform refresh occurs, the statefile is rendered without a name field. A subsequent terraform plan attempts to re-create a resource which does not exist. This does not cooperate well with things life a lifecycle prevent_destroy attached to the resource.
By adding the
name
field to the terraform statefile, it begins to work properly. Given thatname
is a computed, Output only parameterSteps to Reproduce
terraform refresh
terraform plan
Important Factoids
I am attempting to use terrajet to create a YAML representation of an Apigee Organization (and subsequent resources). When it renders the YAML, it correctly detects that the
name
field is not an argument, and does not add it to the YAML resources or to the rendered main.tf.json.However, it fails to complete a plan because after doing a terraform refresh. To illustrate, terrajet renders this terraform.tfstate originally:
Upon
terraform refresh
the state file is then mutated to look like this:This state file, upon then performing a terraform plan, attempts to recreate the resource, which fails because the lifecycle prevent_destroy flag is set.
By adding a correct name field to this updated state file, I can get the
terraform plan
to execute without trying to re-create the resource. The apparent issue then is that the name, a computed output field, is somehow used above theid
field from the state file to determine if the resource exists.It appears that the name from the config is used to render the HTTP URL used, but may not necessarily known leading to this behavior.
Terrajet does provide facilities to pre-render or mutate the
id
field from known data, but it doesn't have one forname
. Ifname
is also an input attribute, then it should just work as-is, however, this particular resource does not support aname
field.References
None yet. I may link in a terrajet workaround that would hopefully let us work around this issue.
The text was updated successfully, but these errors were encountered: