-
Notifications
You must be signed in to change notification settings - Fork 4.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
azurerm_key_vault data source causes Terraform to think its ID has changed #7052
Comments
Thanks for opening this issue Taking a look into this this appears to be an issue in Terraform Core where Data Sources aren't cached in the Terraform Statefile and as such Terraform needs to refresh them on every launch - ultimately meaning that Terraform believes there's changes here. This bug is being tracked in this issue in Terraform Core which I'm going to close this in favour of - would you mind subscribing to that issue for updates? Thanks! |
@MarcDufresne Can I ask a quick question, do you explicitly suppress refresh when doing plan/apply? |
@magodo Do you mean explicitly passing |
OK, I suppose you did not. I actually tried to reproduce your issue in my local setup but failed. main.tf module "a" {
source = "./moduleA"
name = "foo"
}
module "b" {
source = "./moduleB"
a_id = module.a.id
}
output "b_id" {
value = module.b.id
} moduleA/main.tf variable "name" {
type = string
}
resource "null_resource" "resource_in_a" {
triggers = {
name = var.name
}
}
output "id" {
value = null_resource.resource_in_a.id
} moduleB/main.tf variable "a_id" {
type = string
}
data "null_data_source" "data_in_b" {
inputs = {
id = var.a_id
}
}
resource "null_resource" "resource_in_b" {
triggers = data.null_data_source.data_in_b.outputs
}
output "id" {
value = null_resource.resource_in_b.id
} (moduleA represents your module which provisions |
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. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Hello, I have an issue with the
azurerm_key_vault_secret
resource. Basically, Terraform detects that the Key Vault ID has changed, however it did not, and wants to delete my secrets to recreate them in the "new" key vault.The Kay Vault itself has been created in another module earlier, and this doesn't trigger anything in Terraform. I am using the data provider
azurerm_key_vault
to get my previously created key vault, I am thinking this might be the cause. That, or I am somehow doing something wrong.Community Note
Terraform (and AzureRM Provider) Version
Terraform v0.12.24
Affected Resource(s)
azurerm_key_vault_secret
data.azurerm_key_vault
Terraform Configuration Files
Debug Output
This is the result of running
terraform plan
:And then this happens if I execute the plan
And then if I
plan
again:Expected Behavior
Terraform should not have detected any changes since no values or resources were changed.
Actual Behavior
Terraform detected a Key Vault ID change, thus planning to destroy my secret and recreate it. On top of that it also fails to do it with a
409
from Azure if I do run it.Steps to Reproduce
terraform apply
Workarounds
azurerm_key_vault_secret
, instead of the name and using theazurerm_key_vault
data source (I already outputted the KV name for another thing, so I figured I would reuse it instead of adding a new output)lifecycle.ignore_change = [key_vault_id]
on my secret resourceThe text was updated successfully, but these errors were encountered: