Skip to content
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

Support admin partitions for consul_acl_token_secret_id #307

Closed
jrx opened this issue Apr 25, 2022 · 3 comments
Closed

Support admin partitions for consul_acl_token_secret_id #307

jrx opened this issue Apr 25, 2022 · 3 comments

Comments

@jrx
Copy link
Member

jrx commented Apr 25, 2022

Terraform Version

Terraform v1.1.8

Affected Resource(s)

  • consul_acl_token_secret_id

Terraform Configuration Files

resource "consul_admin_partition" "nomad" {
  name        = "nomad"
  description = "Partition for Nomad"
}

resource "consul_acl_policy" "nomad_server" {
  name      = "nomad-server"
  partition = consul_admin_partition.nomad.name

  rules = <<-RULE
    agent_prefix "" {
        policy = "read"
    }
    node_prefix "" {
        policy = "read"
    }
    service_prefix "" {
        policy = "write"
    }
    acl = "write"
    RULE
}

resource "consul_acl_token" "nomad_server" {
  description = "Nomad Server Policy"
  policies    = ["${consul_acl_policy.nomad_server.name}"]
  local       = true
  partition   = consul_admin_partition.nomad.name
}

data "consul_acl_token_secret_id" "nomad_server" {
  accessor_id = consul_acl_token.nomad_server.id
}

Debug Output

│ Error: Unexpected response code: 403 (ACL not found)
│
│   with data.consul_acl_token_secret_id.nomad_server,
│   on policies.tf line 106, in data "consul_acl_token_secret_id" "nomad_server":
│  106: data "consul_acl_token_secret_id" "nomad_server" {
│
╵
Operation failed: failed running terraform plan (exit 1)

Expected Behavior

The resource consul_acl_token_secret_id should provide an argument to configure the admin partition. e.g.:

data "consul_acl_token_secret_id" "nomad_server" {
  accessor_id = consul_acl_token.nomad_server.id
  partition  = consul_admin_partition.nomad.name
}

Actual Behavior

The resource consul_acl_token_secret_id has only support for the namespace argument as of today:
https://registry.terraform.io/providers/hashicorp/consul/latest/docs/data-sources/acl_token_secret_id#argument-reference

Steps to Reproduce

terraform apply

@remilapeyre
Copy link
Collaborator

Hi @jrx! Thanks, for some reason this datasource was forgotten when adding the support for admin partitions. I will work on it shortly.

@mkeeler
Copy link
Member

mkeeler commented Aug 18, 2022

This was fixed in #315.

@remilapeyre
Copy link
Collaborator

Thanks @mkeeler !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants