hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

data google_policy_analyser #19145

Open marcelo-avaya opened 1 month ago

marcelo-avaya commented 1 month ago

Community Note

Description

Expose the Policy Analyser feature currently in the GCP console in Terraform

New or Affected Resource(s)

Potential Terraform Configuration

data "google_policy_analyser" "main" {
  project_id = "dummy_12345"
  resources = ["long_resource_id1", "long_resource_id2"]
  principals = ["principal_id1", "principal_id2"]
  roles = ["roles/compute.viewer", "roles/compute.networkAdmin"]
  permissions = ["compute.firewalls.create", "compute.firewalls.delete"]
}

Resource attribute should include those present in the Policy Analyser.

References

No response

b/360875709

melinath commented 3 weeks ago

Note from triage: Based on https://cloud.google.com/policy-intelligence/docs/analyze-iam-policies#policy-analyzer-principal-resource-access-rest it looks like this is powered by the Cloud Asset API: https://cloud.google.com/policy-intelligence/docs/reference/asset-inventory