Open A30004028 opened 4 years ago
Hi @A30004028 Thanks for your feedback. This is because you have secret values in your configuration, service won't return secret values. We fix this to support secret values improt ,but you will lost the secret values.
Thats fine, the secrets are maintained elsewhere in code. Am I right in thinking the values will get reapplied on the next plan/apply?
yes, you are correct.
So how would you import a variable group with secrets? Create an additional group and confirm that your IaC is able to recreate the original group then do a cutover to remove the original group and create it with TF? Would it be better to throw a warning that you weren't able to import the secrets?
Also on a tangental topic, if TF isn't able to see secret data then how is TF able to determine if the secret changes and therefore update it? Is it possible to get anything out of MS like a one-way hash that could be used to determine changes?
@A30004028 @DamonStamper Sorry I misunderstand you at first. Currently, ADO provider doesn't support import secret values and we cannot do that because service won't return this secret values.
Terraform check if values have been changed based on .tfstate
and .tf
configuration.
Ok, I'm lost here again.
Will an tf import call, import the variable group AND the variable names of sensitive variables (but not the value)?
If so, will the the next plan/apply attempt to update the values of the sensitive variables due to an inconsistency between the .tfstate
and .tf
configuration?
@A30004028 You point it good, we can investigate if we can import only names then apply again to get this values back into .tfstate
.
I have a large number of variable groups containing a mixture of sensitive and non-sensitive config. The sensitive variables are marked as secrets (i.e. in Azure DevOps they appear as ** ).
The presence of a secret in a variable group seems to result in the import failure
'Error: rpc error: code = Unavailable desc = transport is closing'
As soon as I remove the sensitive value the import succeeds.
The behaviour that I was hoping to see was that the variable group would be imported but that the state would have blank values for the secrets. Or that the variables would be missing entirely from the state. Or that the values for secrets would be some shouty text.
I would then apply a subsequent plan that is able to set these secrets (from outputs of other resources or modules).
Community Note
Terraform (and Azure DevOps Provider) Version
Affected Resource(s)
azuredevops_variable_group
Terraform Configuration Files
Debug Output
https://gist.github.com/A30004028/211299a02a409303cdad651145173019
Panic Output
https://gist.github.com/A30004028/211299a02a409303cdad651145173019
Expected Behavior
Resource is imported succesfully as per https://www.terraform.io/docs/providers/azuredevops/r/variable_group.html#import
Actual Behavior
Resource import crashes
Steps to Reproduce
terraform import azuredevops_variable_group.main "AAA"/846
Important Factoids
References
0000