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

Data source for IAM Testable Permissions #2071

Conversation

modular-magician
Copy link
Collaborator

Release Note Template for Downstream PRs (will be copied)

Add google_iam_testable_permissions data source

Fixes: hashicorp/terraform-provider-google#6120
Fixes: hashicorp/terraform-provider-google#4812

Adds a new data source for IAM testable permissions.

data "google_iam_testable_permissions" "perms" {
	full_resource_name   = "//cloudresourcemanager.googleapis.com/projects/my-project"
        custom_support_level = "NOT_SUPPORTED"
        stages               = ["GA", "BETA"]
}

output "perms" {
	value = data.google_iam_testable_permissions.perms.permissions
}

Then the output will look like this:

$ terraform apply
data.google_iam_testable_permissions.perms: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

perms = [
  {
    "api_disabled" = false
    "custom_support_level" = "NOT_SUPPORTED"
    "name" = "appengine.runtimes.actAsAdmin"
    "stage" = "GA"
    "title" = ""
  },
  {
    "api_disabled" = false
    "custom_support_level" = "NOT_SUPPORTED"
    "name" = "cloudsql.sslCerts.createEphemeral"
    "stage" = "GA"
    "title" = ""
  },

Derived from GoogleCloudPlatform/magic-modules#3460

* Added new data source for iam_testable_permissions

* Added tests and docs

* Fixed linter errors

* Use sdk validation package and allow case-insensitive

* Changed stage to stages list and concat results

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit 32518d0 into hashicorp:master May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant