Skip to content

Commit 105fe52

Browse files
nbugdendaniel-cit
andauthored
fix!: use bootstrap.outputs.common_config as default region (#1181)
Co-authored-by: Daniel Andrade <[email protected]>
1 parent e23f95e commit 105fe52

File tree

83 files changed

+902
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+902
-138
lines changed

0-bootstrap/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ Each step has instructions for this change.
307307
| bucket\_prefix | Name prefix to use for state bucket created. | `string` | `"bkt"` | no |
308308
| bucket\_tfstate\_kms\_force\_destroy | When deleting a bucket, this boolean option will delete the KMS keys used for the Terraform state bucket. | `bool` | `false` | no |
309309
| default\_region | Default region to create resources where applicable. | `string` | `"us-central1"` | no |
310+
| default\_region\_2 | Secondary default region to create resources where applicable. | `string` | `"us-west1"` | no |
311+
| default\_region\_gcs | Case-Sensitive default region to create gcs resources where applicable. | `string` | `"US"` | no |
312+
| default\_region\_kms | Secondary default region to create kms resources where applicable. | `string` | `"us"` | no |
310313
| folder\_prefix | Name prefix to use for folders created. Should be the same in all steps. | `string` | `"fldr"` | no |
311314
| groups | Contain the details of the Groups to be created. | <pre>object({<br> create_required_groups = optional(bool, false)<br> create_optional_groups = optional(bool, false)<br> billing_project = optional(string, null)<br> required_groups = object({<br> group_org_admins = string<br> group_billing_admins = string<br> billing_data_users = string<br> audit_data_users = string<br> monitoring_workspace_users = string<br> })<br> optional_groups = optional(object({<br> gcp_security_reviewer = optional(string, "")<br> gcp_network_viewer = optional(string, "")<br> gcp_scc_admin = optional(string, "")<br> gcp_global_secrets_admin = optional(string, "")<br> gcp_kms_admin = optional(string, "")<br> }), {})<br> })</pre> | n/a | yes |
312315
| initial\_group\_config | Define the group configuration when it is initialized. Valid values are: WITH\_INITIAL\_OWNER, EMPTY and INITIAL\_GROUP\_CONFIG\_UNSPECIFIED. | `string` | `"WITH_INITIAL_OWNER"` | no |

0-bootstrap/modules/tfc-agent-gke/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ resource "google_compute_firewall" "allow_private_api_egress" {
372372

373373
module "private_service_connect" {
374374
source = "terraform-google-modules/network/google//modules/private-service-connect"
375-
version = "~> 9.0"
375+
version = "~> 9.1"
376376

377377
project_id = var.project_id
378378
dns_code = "dz-${local.vpc_name}"

0-bootstrap/outputs.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ output "common_config" {
5656
parent_folder = var.parent_folder,
5757
billing_account = var.billing_account,
5858
default_region = var.default_region,
59+
default_region_2 = var.default_region_2,
60+
default_region_gcs = var.default_region_gcs,
61+
default_region_kms = var.default_region_kms,
5962
project_prefix = var.project_prefix,
6063
folder_prefix = var.folder_prefix
6164
parent_id = local.parent

0-bootstrap/terraform.example.tfvars

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ groups = {
4040
# }
4141
}
4242

43-
default_region = "us-central1"
43+
default_region = "us-central1"
44+
default_region_2 = "us-west1"
45+
default_region_gcs = "US"
46+
default_region_kms = "us"
4447

4548
# Optional - for an organization with existing projects or for development/validation.
4649
# Uncomment this variable to place all the example foundation resources under

0-bootstrap/variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ variable "default_region" {
3030
default = "us-central1"
3131
}
3232

33+
variable "default_region_2" {
34+
description = "Secondary default region to create resources where applicable."
35+
type = string
36+
default = "us-west1"
37+
}
38+
39+
variable "default_region_gcs" {
40+
description = "Case-Sensitive default region to create gcs resources where applicable."
41+
type = string
42+
default = "US"
43+
}
44+
45+
variable "default_region_kms" {
46+
description = "Secondary default region to create kms resources where applicable."
47+
type = string
48+
default = "us"
49+
}
50+
3351
variable "parent_folder" {
3452
description = "Optional - for an organization with existing projects or for development/validation. It will place all the example foundation resources under the provided folder instead of the root organization. The value is the numeric folder ID. The folder must already exist."
3553
type = string

1-org/envs/shared/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
| Name | Description | Type | Default | Required |
55
|------|-------------|------|---------|:--------:|
6-
| billing\_export\_dataset\_location | The location of the dataset for billing data export. | `string` | `"US"` | no |
6+
| billing\_export\_dataset\_location | The location of the dataset for billing data export. | `string` | `null` | no |
77
| cai\_monitoring\_kms\_force\_destroy | If set to true, delete KMS keyring and keys when destroying the module; otherwise, destroying the module will fail if KMS keys are present. | `bool` | `false` | no |
88
| create\_access\_context\_manager\_access\_policy | Whether to create access context manager access policy. | `bool` | `true` | no |
99
| create\_unique\_tag\_key | Creates unique organization-wide tag keys by adding a random suffix to each key. | `bool` | `false` | no |
@@ -15,7 +15,7 @@
1515
| essential\_contacts\_language | Essential Contacts preferred language for notifications, as a ISO 639-1 language code. See [Supported languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages) for a list of supported languages. | `string` | `"en"` | no |
1616
| gcp\_groups | Groups to grant specific roles in the Organization.<br> platform\_viewer: Google Workspace or Cloud Identity group that have the ability to view resource information across the Google Cloud organization.<br> security\_reviewer: Google Workspace or Cloud Identity group that members are part of the security team responsible for reviewing cloud security<br> network\_viewer: Google Workspace or Cloud Identity group that members are part of the networking team and review network configurations.<br> scc\_admin: Google Workspace or Cloud Identity group that can administer Security Command Center.<br> audit\_viewer: Google Workspace or Cloud Identity group that members are part of an audit team and view audit logs in the logging project.<br> global\_secrets\_admin: Google Workspace or Cloud Identity group that members are responsible for putting secrets into Secrets Manage | <pre>object({<br> audit_viewer = optional(string, null)<br> security_reviewer = optional(string, null)<br> network_viewer = optional(string, null)<br> scc_admin = optional(string, null)<br> global_secrets_admin = optional(string, null)<br> kms_admin = optional(string, null)<br> })</pre> | `{}` | no |
1717
| log\_export\_storage\_force\_destroy | (Optional) If set to true, delete all contents when destroying the resource; otherwise, destroying the resource will fail if contents are present. | `bool` | `false` | no |
18-
| log\_export\_storage\_location | The location of the storage bucket used to export logs. | `string` | `"US"` | no |
18+
| log\_export\_storage\_location | The location of the storage bucket used to export logs. | `string` | `null` | no |
1919
| log\_export\_storage\_retention\_policy | Configuration of the bucket's data retention policy for how long objects in the bucket should be retained. | <pre>object({<br> is_locked = bool<br> retention_period_days = number<br> })</pre> | `null` | no |
2020
| log\_export\_storage\_versioning | (Optional) Toggles bucket versioning, ability to retain a non-current object version when the live object version gets replaced or deleted. | `bool` | `false` | no |
2121
| project\_budget | Budget configuration for projects.<br> budget\_amount: The amount to use as the budget.<br> alert\_spent\_percents: A list of percentages of the budget to alert on when threshold is exceeded.<br> alert\_pubsub\_topic: The name of the Cloud Pub/Sub topic where budget related messages will be published, in the form of `projects/{project_id}/topics/{topic_id}`.<br> alert\_spend\_basis: The type of basis used to determine if spend has passed the threshold. Possible choices are `CURRENT_SPEND` or `FORECASTED_SPEND` (default). | <pre>object({<br> dns_hub_budget_amount = optional(number, 1000)<br> dns_hub_alert_spent_percents = optional(list(number), [1.2])<br> dns_hub_alert_pubsub_topic = optional(string, null)<br> dns_hub_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> base_net_hub_budget_amount = optional(number, 1000)<br> base_net_hub_alert_spent_percents = optional(list(number), [1.2])<br> base_net_hub_alert_pubsub_topic = optional(string, null)<br> base_net_hub_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> base_network_budget_amount = optional(number, 1000)<br> base_network_alert_spent_percents = optional(list(number), [1.2])<br> base_network_alert_pubsub_topic = optional(string, null)<br> base_network_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> restricted_net_hub_budget_amount = optional(number, 1000)<br> restricted_net_hub_alert_spent_percents = optional(list(number), [1.2])<br> restricted_net_hub_alert_pubsub_topic = optional(string, null)<br> restricted_net_hub_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> restricted_network_budget_amount = optional(number, 1000)<br> restricted_network_alert_spent_percents = optional(list(number), [1.2])<br> restricted_network_alert_pubsub_topic = optional(string, null)<br> restricted_network_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> interconnect_budget_amount = optional(number, 1000)<br> interconnect_alert_spent_percents = optional(list(number), [1.2])<br> interconnect_alert_pubsub_topic = optional(string, null)<br> interconnect_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> org_secrets_budget_amount = optional(number, 1000)<br> org_secrets_alert_spent_percents = optional(list(number), [1.2])<br> org_secrets_alert_pubsub_topic = optional(string, null)<br> org_secrets_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> org_billing_logs_budget_amount = optional(number, 1000)<br> org_billing_logs_alert_spent_percents = optional(list(number), [1.2])<br> org_billing_logs_alert_pubsub_topic = optional(string, null)<br> org_billing_logs_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> org_audit_logs_budget_amount = optional(number, 1000)<br> org_audit_logs_alert_spent_percents = optional(list(number), [1.2])<br> org_audit_logs_alert_pubsub_topic = optional(string, null)<br> org_audit_logs_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> org_kms_budget_amount = optional(number, 1000)<br> org_kms_alert_spent_percents = optional(list(number), [1.2])<br> org_kms_alert_pubsub_topic = optional(string, null)<br> org_kms_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> scc_notifications_budget_amount = optional(number, 1000)<br> scc_notifications_alert_spent_percents = optional(list(number), [1.2])<br> scc_notifications_alert_pubsub_topic = optional(string, null)<br> scc_notifications_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> })</pre> | `{}` | no |

1-org/envs/shared/log_sinks.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module "logs_export" {
5353
logging_sink_filter = local.logs_filter
5454
logging_sink_name = "sk-c-logging-bkt"
5555
storage_bucket_name = "bkt-${module.org_audit_logs.project_id}-org-logs-${random_string.suffix.result}"
56-
location = var.log_export_storage_location
56+
location = coalesce(var.log_export_storage_location, local.default_region)
5757
retention_policy_enabled = var.log_export_storage_retention_policy != null
5858
retention_policy_is_locked = var.log_export_storage_retention_policy == null ? null : var.log_export_storage_retention_policy.is_locked
5959
retention_policy_period_days = var.log_export_storage_retention_policy == null ? null : var.log_export_storage_retention_policy.retention_period_days
@@ -93,5 +93,5 @@ resource "google_bigquery_dataset" "billing_dataset" {
9393
dataset_id = "billing_data"
9494
project = module.org_billing_logs.project_id
9595
friendly_name = "GCP Billing Data"
96-
location = var.billing_export_dataset_location
96+
location = coalesce(var.billing_export_dataset_location, local.default_region)
9797
}

1-org/envs/shared/terraform.example.tfvars

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ scc_notification_name = "scc-notify"
2323

2424
remote_state_bucket = "REMOTE_STATE_BUCKET"
2525

26+
log_export_storage_location = "US"
27+
28+
billing_export_dataset_location = "US"
29+
2630
//scc_notification_filter = "state=\\\"ACTIVE\\\""
2731

2832
//enable_hub_and_spoke = true

1-org/envs/shared/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ variable "data_access_logs_enabled" {
5757
variable "log_export_storage_location" {
5858
description = "The location of the storage bucket used to export logs."
5959
type = string
60-
default = "US"
60+
default = null
6161
}
6262

6363
variable "billing_export_dataset_location" {
6464
description = "The location of the dataset for billing data export."
6565
type = string
66-
default = "US"
66+
default = null
6767
}
6868

6969
variable "log_export_storage_force_destroy" {

3-networks-dual-svpc/envs/development/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
locals {
1818
env = "development"
1919
environment_code = substr(local.env, 0, 1)
20-
default_region1 = "us-west1"
21-
default_region2 = "us-central1"
2220
/*
2321
* Base network ranges
2422
*/

0 commit comments

Comments
 (0)