Skip to content

Support JSON Object for Policy Statements in launchdarkly_custom_role Resource #217

Open
@yonivoi96

Description

I would like to request a feature enhancement for the launchdarkly_custom_role resource in the LaunchDarkly Terraform provider. Currently, the policy statements must be defined using multiple policy_statements nested blocks.
The current approach makes it hard to manage complex roles with numerous policies.
The suggested behavior can help with it and in addition it will enable to use Terraform's powerful templating features.

Current behavior:

resource "launchdarkly_custom_role" "example" {
  key         = "example-role-key-1"
  name        = "example role"
  description = "This is an example role"

  policy_statements {
    effect    = "allow"
    resources = ["proj/*:env/production:flag/*"]
    actions   = ["*"]
  }
  policy_statements {
    effect    = "allow"
    resources = ["proj/*:env/production"]
    actions   = ["*"]
  }
}

Desired behavior:

[
  {
    "effect": "allow",
    "resources": ["proj/*:env/production:flag/*"],
    "actions": ["*"]
  },
  {
    "effect": "allow",
    "resources": ["proj/*:env/production"],
    "actions": ["*"]
  }
]
resource "launchdarkly_custom_role" "example" {
  key         = "example-role-key-1"
  name        = "example role"
  description = "This is an example role"

  policy = jsonencode(file("${path.module}/policy_statements.json"))
}

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions