Skip to content

add support for a google_project_organization_policy resource #1193

Closed
@lawrenae

Description

@lawrenae

I'd like to be able to do the equivelant of the following command in terraform:

cat allow-external-ip.json
{ "constraint": "constraints/compute.vmExternalIpAccess", "listPolicy": { "allValues": ALLOW }}

gcloud beta resource-manager org-policies set-policy allow-external-ip.json --project my-project-id

The bigger use case is to define an org policy at a folder level like so:

resource "google_folder_organization_policy" "no-external-ips" {
  folder     = "${google_folder.cool_folder.name}"
  constraint = "compute.vmExternalIpAccess"

  list_policy {
    deny {
      all = true
    }
  }
}

and then be able to "override" it on a per project basis:

resource "google_project_organization_policy" "cool-project-allow-external-IPs" {
  project    = "${google_project.cool_project.project_id}"
  constraint = "compute.vmExternalIpAccess"

  list_policy {
    allow {
      all = true
    }
  }
}

Thoughts? I'd be interested in alternatives to solving this problem, or implementing the solution in the provider, so please let me know.

Thanks!

-- Andy

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions