Closed rtrox closed 8 months ago
Thanks for reporting this, @rtrox and I appreciate the detail! It looks like we're missing ForceNew
flags for the doppler_secret
resource. A doppler_secret
can't be moved from one project or config to another, it must be deleted and recreated. We use null values in the fetch secrets API to indicate that a secret's value is restricted but we should never have attempted to fetch the secret if it doesn't exist.
I'll get the fix up shortly 👍 Thanks again!
When managing secrets, if terraform attempts to set a value for a secret that exists, but has an empty value (for example, when creating a resource for a new environment in an existing project), having a nil value for that secret leads the terraform provider to believe it doesn't have access to retrieve it, rather than correctly realizing the secret simply has an empty value.
Reproduction:
Example of the error:
Remediations attempted:
Successful remediation: To fix this broken state, I had to set a bogus password value "asdf" through the UI, and then re-run terraform apply.
Provider Configs:
relevant secret entry:
This is the relevant code, it seems to naively assume that a nil value means it doesn't have access: https://github.com/DopplerHQ/terraform-provider-doppler/blob/2407bf224c49e7e3a509735cc2d4b95e34074c14/doppler/resource_secret.go#L119-L132