-
Notifications
You must be signed in to change notification settings - Fork 787
Description
TL;DR
While trying to deploy the terraform foundation, we are facing an error on Step 3-networks-dual-svpc.
We followed all the steps including exporting all the variables and granted all necessary permissions to the serviceAccount:
- ${ORGANIZATION_ID}
- ${ACCESS_CONTEXT_MANAGER_ID}
- ${CICD_PROJECT_ID}
- ${GOOGLE_IMPERSONATE_SERVICE_ACCOUNT}
On step 20.Run apply shared we are not able to create the google_compute_organization_security_policy. I mean the policy is created but seems not able to associate all the folders to the policy, failing after 21 retries everytime.
Expected behavior
Able to run the module ../../modules/hierarchical_firewall_policy properly without issue.
Observed behavior
module.hierarchical_firewall_policy.random_string.suffix: Creating...
module.hierarchical_firewall_policy.random_string.suffix: Creation complete after 0s [id=vo49]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Creating...
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [10s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [20s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [30s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [40s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [50s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [1m0s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [1m10s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [1m20s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [1m30s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [1m40s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [1m50s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [2m0s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [2m10s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [2m20s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [2m30s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [2m40s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [2m50s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [3m0s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [3m10s elapsed]
module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy: Still creating... [3m20s elapsed]
Error: Error waiting to create OrganizationSecurityPolicy: Error waiting for Creating OrganizationSecurityPolicy: couldn't find resource (21 retries)
with module.hierarchical_firewall_policy.google_compute_organization_security_policy.policy,
on ../../modules/hierarchical_firewall_policy/main.tf line 27, in resource "google_compute_organization_security_policy" "policy":
27: resource "google_compute_organization_security_policy" "policy" {
There's more interesting information after adding DEBUG mode:
2025-01-10T16:07:18.552Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: 2025/01/10 16:07:18 [DEBUG] Dismissed an error as retryable. Retry 404s for GET operation - googleapi: Error 404: The resource 'projects/null' was not found, notFound
2025-01-10T16:07:18.552Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: 2025/01/10 16:07:18 [DEBUG] Dismissed retryable error on GET operation "org-[ORG_ID_REDACTED]-[UID_REDACTED]": googleapi: Error 404: The resource 'projects/null' was not found, notFound
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: {
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: "error": {
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: "code": 404,
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: "message": "The resource 'projects/null' was not found",
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: "errors": [
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: {
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: "message": "The resource 'projects/null' was not found",
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: "domain": "global",
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: "reason": "notFound"
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: }
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: ],
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: "status": "NOT_FOUND"
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: }
2025-01-10T16:07:49.018Z [DEBUG] provider.terraform-provider-google-beta_v6.15.0_x5: }
As we can see above, the error message fails at looking for a project, however in the hierarchical_firewall.tf file the module is looking for folders, not projects:
module "hierarchical_firewall_policy" {
source = "../../modules/hierarchical_firewall_policy/"
parent = local.common_folder_name
name = "common-firewall-rules"
associations = [
local.common_folder_name,
local.network_folder_name,
local.bootstrap_folder_name,
local.development_folder_name,
local.production_folder_name,
local.nonproduction_folder_name,
]
Terraform Configuration
We are using this fork https://github.com/Cloud-Gouvernance-Foundation/terraform-example-foundation configured with our environment.Terraform Version
<>/$ terraform version
Terraform v1.5.7
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v6.15.0
+ provider registry.terraform.io/hashicorp/google-beta v6.15.0
+ provider registry.terraform.io/hashicorp/random v3.6.3
Your version of Terraform is out of date! The latest version
is 1.10.4. You can update by downloading from https://www.terraform.io/downloads.html
### Additional information
UTC -4 timezone