Open magzim21 opened 5 months ago
@magzim21
Why would you want a "empty" plan when the secret value in tfstate doesn't match the newly supplied?
I agree that a "1 to add" plan is incorrect - but wouldn't it be better with a "1 to change"
This configuration should produce an empty plan when updating plaintext_value in UI
The emphasize is "updating value in UI" It should be empty because
lifecycle {
ignore_changes = [plaintext_value]
}
So this is the logic that is responsible for this behaviour:
if updatedAt, ok := d.GetOk("updated_at"); ok && updatedAt != secret.UpdatedAt.String() {
log.Printf("[INFO] The secret %s has been externally updated in GitHub", d.Id())
d.SetId("")
} else if !ok {
if err = d.Set("updated_at", secret.UpdatedAt.String()); err != nil {
return err
}
}
Wouldn't this solve our issue, but keep the original functionality as well?
if updatedAt, ok := d.GetOk("updated_at"); ok && updatedAt != secret.UpdatedAt.String() {
log.Printf("[INFO] The secret %s has been externally updated in GitHub", d.Id())
d.Set("encrypted_value", "")
d.Set("plaintext_value", "")
} else if !ok {
if err = d.Set("updated_at", secret.UpdatedAt.String()); err != nil {
return err
}
}
seems to be duplicate of #1383
Expected Behavior
This configuration should produce an empty plan when updating
plaintext_value
in UIActual Behavior
github_actions_environment_secret.terraform_infrastructure_tfe_token will be created
Plan: 1 to add, 0 to change, 0 to destroy.
Terraform Version
Terraform v1.8.2 on darwin_arm64
Affected Resource(s)
Terraform Configuration Files
No response
Steps to Reproduce
No response
Debug Output
Panic Output
No response
Code of Conduct