hashicorp / terraform-provider-consul

Terraform Consul provider
https://www.terraform.io/docs/providers/consul/
Mozilla Public License 2.0
124 stars 113 forks source link

consul_acl_role_policy_attachment causes unresponsive plugin in v2.19.0 #378

Closed reskin89 closed 9 months ago

reskin89 commented 9 months ago

Hi there,

Terraform Version

Terraform v1.1.0 on linux_amd64

Affected Resource(s)

Please list the resources as a list, for example:

Terraform Configuration Files

data "consul_acl_role" "this" {
    name = "test"
}

resource "consul_acl_policy" "this" {
    name = "test"
    description = "test"
    rules       = <<-RULE
        service_prefix "test-" {
            policy = "write"
            intentions = "write"
        }
    RULE
}

resource "consul_acl_role_policy_attachment" "this" {
    role_id = data.consul_acl_role.this.id
    policy = consul_acl_policy.this.name
}

Debug Output

As there are some company internals I can't post the entire debug, but I have put a portion of it in the same gist as the panic output.

Panic Output

https://gist.github.com/reskin89/b584c75bd4fdff4f9473c495f0e913bd

Expected Behavior

An ACL policy should have been attached to the role

Actual Behavior

The crash noted above

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. create an ACL role
  2. Retrieve that role via the consul_acl_role data source
  3. attempt to attach an acl policy via the consul_acl_role_policy_attachment resource

Important Factoids

N/A

References

reskin89 commented 9 months ago

I also attempted to do this w/ the provider version v2.18.0 and received this error:

│ Error: Invalid resource type
│ 
│   on .terraform/modules/application_token/application-token/main.tf line 79, in resource "consul_acl_role_policy_attachment" "management":
│   79: resource "consul_acl_role_policy_attachment" "management" {
│ 
│ The provider hashicorp/consul does not support resource type "consul_acl_role_policy_attachment".
╵

I checked the code in tag v2.18.0 and see that this resource does in fact exist in that version of the provider.

reskin89 commented 9 months ago

v2.17.0 also says the resource doesn't exist but the code in 2.17 clearly has it, not really sure what's going on here. I've also copy/pasted the resource naming to ensure there's no typos 😄

remilapeyre commented 9 months ago

Hello @reskin89, are you sure you do not have a dev-override configuration on your computer?

remilapeyre commented 9 months ago

Could you also indicate what version of Consul you are using?

reskin89 commented 9 months ago

No dev overrides, consul 1.16.1

remilapeyre commented 9 months ago

Thanks, for the details @reskin89. I found the source of the bug and will make a release shortly.

reskin89 commented 9 months ago

Thank you @remilapeyre !!