From 2b33644ecd4280c3ba7dd87e6f8f5e1cd7279199 Mon Sep 17 00:00:00 2001 From: Ludo Date: Fri, 24 May 2024 07:58:18 +0200 Subject: [PATCH 1/5] gcs module --- modules/gcs/README.md | 11 ++++++++++- modules/gcs/variables.tf | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/gcs/README.md b/modules/gcs/README.md index d94a40dbeb..c11dfcf03b 100644 --- a/modules/gcs/README.md +++ b/modules/gcs/README.md @@ -21,6 +21,7 @@ module "bucket" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" versioning = true labels = { cost-center = "devops" @@ -62,8 +63,8 @@ module "bucket" { project_id = var.project_id prefix = var.prefix name = "my-bucket" - encryption_key = module.kms.keys.bucket_key.id location = "EU" + encryption_key = module.kms.keys.bucket_key.id } # tftest modules=3 skip e2e @@ -77,6 +78,7 @@ module "bucket" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" retention_policy = { retention_period = 100 is_locked = true @@ -98,6 +100,7 @@ module "bucket" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" lifecycle_rules = { lr-0 = { action = { @@ -127,6 +130,7 @@ module "bucket-gcs-notification" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" notification_config = { enabled = true payload_format = "JSON_API_V1" @@ -147,6 +151,7 @@ module "bucket" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" objects_to_upload = { sample-data = { name = "example-file.csv" @@ -176,6 +181,7 @@ module "bucket" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" iam = { "roles/storage.admin" = ["group:${var.group_email}"] } @@ -189,6 +195,7 @@ module "bucket" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" iam_bindings = { storage-admin-with-delegated_roles = { role = "roles/storage.admin" @@ -217,6 +224,7 @@ module "bucket" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" iam_bindings_additive = { storage-admin-with-delegated_roles = { role = "roles/storage.admin" @@ -264,6 +272,7 @@ module "bucket" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" tag_bindings = { env-sandbox = module.org.tag_values["environment/sandbox"].id } diff --git a/modules/gcs/variables.tf b/modules/gcs/variables.tf index 993a855fea..b33f2d5b08 100644 --- a/modules/gcs/variables.tf +++ b/modules/gcs/variables.tf @@ -149,7 +149,7 @@ variable "lifecycle_rules" { variable "location" { description = "Bucket location." type = string - default = "EU" + # default = "EU" } variable "logging_config" { From ffc29f4a95dd055763e2d20ad3eb5c0f8bcaa846 Mon Sep 17 00:00:00 2001 From: Ludo Date: Fri, 24 May 2024 07:58:30 +0200 Subject: [PATCH 2/5] blueprints/apigee/bigquery-analytics --- blueprints/apigee/bigquery-analytics/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/blueprints/apigee/bigquery-analytics/main.tf b/blueprints/apigee/bigquery-analytics/main.tf index b90bec0712..5e8404283e 100644 --- a/blueprints/apigee/bigquery-analytics/main.tf +++ b/blueprints/apigee/bigquery-analytics/main.tf @@ -136,6 +136,7 @@ module "bucket_export" { source = "../../../modules/gcs" project_id = module.project.project_id name = "${module.project.project_id}-export" + location = var.organization.analytics_region iam = { "roles/storage.objectViewer" = [ module.function_gcs2bq.service_account_iam_email From f4619b962cb5e31acf9d76bd249f1f032acbf05d Mon Sep 17 00:00:00 2001 From: Ludo Date: Fri, 24 May 2024 08:00:59 +0200 Subject: [PATCH 3/5] tfdoc --- modules/gcs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gcs/README.md b/modules/gcs/README.md index c11dfcf03b..e05d4602f8 100644 --- a/modules/gcs/README.md +++ b/modules/gcs/README.md @@ -284,6 +284,7 @@ module "bucket" { | name | description | type | required | default | |---|---|:---:|:---:|:---:| +| [location](variables.tf#L149) | Bucket location. | string | ✓ | | | [name](variables.tf#L164) | Bucket name suffix. | string | ✓ | | | [project_id](variables.tf#L219) | Bucket project id. | string | ✓ | | | [autoclass](variables.tf#L17) | Enable autoclass to automatically transition objects to appropriate storage classes based on their access pattern. If set to true, storage_class must be set to STANDARD. Defaults to false. | bool | | false | @@ -297,7 +298,6 @@ module "bucket" { | [iam_bindings_additive](variables.tf#L79) | Individual additive IAM bindings. Keys are arbitrary. | map(object({…})) | | {} | | [labels](variables.tf#L94) | Labels to be attached to all buckets. | map(string) | | {} | | [lifecycle_rules](variables.tf#L100) | Bucket lifecycle rule. | map(object({…})) | | {} | -| [location](variables.tf#L149) | Bucket location. | string | | "EU" | | [logging_config](variables.tf#L155) | Bucket logging configuration. | object({…}) | | null | | [notification_config](variables.tf#L169) | GCS Notification configuration. | object({…}) | | null | | [objects_to_upload](variables.tf#L183) | Objects to be uploaded to bucket. | map(object({…})) | | {} | From 521af7c6928089040705d42be58303e635dd36d5 Mon Sep 17 00:00:00 2001 From: Ludo Date: Fri, 24 May 2024 08:07:01 +0200 Subject: [PATCH 4/5] pubsub README md syntax --- modules/pubsub/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/pubsub/README.md b/modules/pubsub/README.md index 4aaa4a4812..08b9217c0e 100644 --- a/modules/pubsub/README.md +++ b/modules/pubsub/README.md @@ -141,6 +141,7 @@ module "pubsub" { } # tftest modules=2 resources=4 fixtures=fixtures/gcs.tf inventory=cloud-storage-subscription.yaml e2e ``` + ### Subscriptions with IAM ```hcl From 15eb913c6e30158e855201e6021acce25136e354 Mon Sep 17 00:00:00 2001 From: Ludo Date: Fri, 24 May 2024 08:52:15 +0200 Subject: [PATCH 5/5] fix tests --- modules/folder/README.md | 1 + modules/organization/README.md | 1 + modules/project/README.md | 2 ++ modules/pubsub/README.md | 2 +- modules/pubsub/variables.tf | 1 - tests/fixtures/gcs.tf | 3 ++- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/folder/README.md b/modules/folder/README.md index ff242aeec0..219df4c1b3 100644 --- a/modules/folder/README.md +++ b/modules/folder/README.md @@ -209,6 +209,7 @@ module "gcs" { project_id = var.project_id prefix = var.prefix name = "gcs_sink" + location = "EU" force_destroy = true } diff --git a/modules/organization/README.md b/modules/organization/README.md index f0253d11b3..7a4421cd1f 100644 --- a/modules/organization/README.md +++ b/modules/organization/README.md @@ -272,6 +272,7 @@ module "gcs" { project_id = var.project_id prefix = var.prefix name = "gcs_sink" + location = "EU" force_destroy = true } diff --git a/modules/project/README.md b/modules/project/README.md index cd92870a47..8d88d0cae4 100644 --- a/modules/project/README.md +++ b/modules/project/README.md @@ -543,6 +543,7 @@ module "gcs" { source = "./fabric/modules/gcs" project_id = var.project_id name = "gcs_sink" + location = "EU" prefix = var.prefix force_destroy = true } @@ -1133,6 +1134,7 @@ module "gcs" { source = "./fabric/modules/gcs" project_id = var.project_id name = "gcs_sink" + location = "EU" prefix = var.prefix force_destroy = true } diff --git a/modules/pubsub/README.md b/modules/pubsub/README.md index 08b9217c0e..856deab1b9 100644 --- a/modules/pubsub/README.md +++ b/modules/pubsub/README.md @@ -174,7 +174,7 @@ module "pubsub" { | [message_retention_duration](variables.tf#L67) | Minimum duration to retain a message after it is published to the topic. | string | | null | | [regions](variables.tf#L83) | List of regions used to set persistence policy. | list(string) | | [] | | [schema](variables.tf#L90) | Topic schema. If set, all messages in this topic should follow this schema. | object({…}) | | null | -| [subscriptions](variables.tf#L100) | Topic subscriptions. Also define push configs for push subscriptions. If options is set to null subscription defaults will be used. Labels default to topic labels if set to null. | map(object({…})) | | {} | +| [subscriptions](variables.tf#L100) | Topic subscriptions. Also define push configs for push subscriptions. If options is set to null subscription defaults will be used. Labels default to topic labels if set to null. | map(object({…})) | | {} | ## Outputs diff --git a/modules/pubsub/variables.tf b/modules/pubsub/variables.tf index 370c42fa77..6ea20f6d52 100644 --- a/modules/pubsub/variables.tf +++ b/modules/pubsub/variables.tf @@ -116,7 +116,6 @@ variable "subscriptions" { minimum_backoff = optional(number) maximum_backoff = optional(number) })) - bigquery = optional(object({ table = string use_topic_schema = optional(bool, false) diff --git a/tests/fixtures/gcs.tf b/tests/fixtures/gcs.tf index 107a36e4d1..86309aef67 100644 --- a/tests/fixtures/gcs.tf +++ b/tests/fixtures/gcs.tf @@ -17,7 +17,8 @@ module "gcs" { project_id = var.project_id prefix = var.prefix name = "my-bucket" + location = "EU" iam = { "roles/storage.admin" = ["serviceAccount:service-${var.project_number}@gcp-sa-pubsub.iam.gserviceaccount.com"] } -} \ No newline at end of file +}