terraform-google-modules / terraform-google-vpc-service-controls

Handles opinionated VPC Service Controls and Access Context Manager configuration and deployments
https://registry.terraform.io/modules/terraform-google-modules/vpc-service-controls/google
Apache License 2.0
59 stars 67 forks source link

Creation of Access Policy error due to existing "default" policy #89

Closed Jluna-sada closed 1 year ago

Jluna-sada commented 1 year ago

TL;DR

There seems to be an issue when you try to create an Access Policy because one exist with "parent" already. I know you can create multiple policies in the Google Console no problem but it seem terraform doesn't allow it?

Expected behavior

Using the module I expect a new access policy to be created.

Observed behavior

│ Error: Error creating AccessPolicy: googleapi: Error 409: Policy already exists with parent organizations/*48148867*** │ │ with module.vpc-service-controls_example_simple_example_access_level.module.access_context_manager_policy.google_access_context_manager_access_policy.access_policy, │ on .terraform/modules/vpc-service-controls_example_simple_example_access_level/main.tf line 17, in resource "google_access_context_manager_access_policy" "access_policy": │ 17: resource "google_access_context_manager_access_policy" "access_policy" {

Terraform Configuration

module "vpc-service-controls_example_simple_example_access_level" {
  source         = "terraform-google-modules/vpc-service-controls/google//examples/simple_example_access_level"
  version        = "4.0.1"
  ip_subnetworks = ["0.0.0.0/0"]
  parent_id      = "*4814886****"
  policy_name    = "bce-terraform"
  protected_project_id = "297533****"

}

Terraform Version

Terraform v1.0.9
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v4.31.0

Additional information

Seeing the same error when using https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/access_context_manager_access_policy

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days