hashicorp / terraform-provider-consul

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

New `consul_acl_role_policy_attachment` resource #354

Closed lawliet89 closed 10 months ago

lawliet89 commented 11 months ago

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

1.5.7

Affected Resource(s)

New Resource

Example Usage

data "consul_acl_role" "terminating_gateway" {
  name = "consul-terminating-gateway-acl-role" # Name of terminating gateway is "terminating-gateway"
}

resource "consul_acl_policy" "external_service" {
  name        = "external-service"
  description = "Token Policy managed by TF"
  rules       = <<-RULE
    service "terminating-gateway" {
      policy = "write"
    }
    service "external-service" {
      policy = "write"
    }
    node_prefix "" {
      policy = "read"
    }
    RULE
}

resource "consul_acl_role_policy_attachment" "custom" {
  role_id = data.consul_acl_role.terminating_gateway.id
  policy  = consul_acl_policy.external_service.name
}

This is a feature request to add a resource to attach arbitrary policies to ACL roles. This is useful in cases where roles are created by components in consul-k8s.