terraform-provider-vault icon indicating copy to clipboard operation
terraform-provider-vault copied to clipboard

tf wants to update vault_consul_secret_backend_role despite no changes

Open inflatador opened this issue 3 years ago • 1 comments

Terraform Version

Terraform v1.2.4 on darwin_amd64

  • provider registry.terraform.io/hashicorp/consul v2.15.1
  • provider registry.terraform.io/hashicorp/vault v3.7.0

Affected Resource(s)

Please list the resources as a list, for example:

  • vault_consul_secret_backend_role

Terraform Configuration Files

resource "consul_acl_policy" "consul_agent_acls" {
  name  = "consul_agent_acls"
  description = "Provides access for consul agents"
  rules = <<-RULE
    node_prefix "consul-" {
      policy = "write"
    }
    node_prefix "" {
      policy = "read"
    }
    service_prefix "" {
      policy = "read"
    }
    RULE
}

resource "vault_consul_secret_backend_role" "consul_agent_role" {
  name = "consul_agent_role"
  backend = vault_consul_secret_backend.consul_path.path
  policies = [ "${consul_acl_policy.consul_agent_acls.name}" ]
}

Debug Output

github gist

Expected Behavior

Terraform should not have detected changes.

Actual Behavior

Terraform detected and applied changes to a resource that did not change in the Terraform file itself.

Steps to Reproduce

  1. terraform apply

Important Factoids

I'm new to vault and consul, and thus could be missing something important.

inflatador avatar Jul 10 '22 19:07 inflatador

I think this relates to the deprecation of policies in favour of consul_policies in vault 1.11+ (https://github.com/hashicorp/vault/pull/15400), which is addressed by PR #1518 and should be in a 3.8.0 release of this provider. I'm waiting for this one myself.

optiz0r avatar Jul 25 '22 15:07 optiz0r

Hi @inflatador - I wanted to check back in on this and see if you tried again with the latest updates to the provider? As optiz0r said, the issue you encountered was likely due to the change with the parameters policies & consul_policies but I want to be sure!

robmonte avatar Aug 18 '22 01:08 robmonte

@robmonte thanks for the ping, I can confirm that this is no longer a problem after upgrading to vault provider 3.8.2 . I appreciate your help on this!

inflatador avatar Aug 19 '22 18:08 inflatador