Skip to content

Commit ad06b79

Browse files
committed
feat: fixed composer 3 env
1 parent ecc7d30 commit ad06b79

File tree

5 files changed

+24
-66
lines changed

5 files changed

+24
-66
lines changed

build/int.cloudbuild.yaml

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 Google LLC
1+
# Copyright 2025 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -25,22 +25,17 @@ steps:
2525
- 'TF_VAR_folder_id=$_FOLDER_ID'
2626
- 'TF_VAR_billing_account=$_BILLING_ACCOUNT'
2727

28-
- id: create all
28+
- id: init-all
2929
waitFor:
3030
- prepare
3131
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
32-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create']
32+
args: ['/bin/bash', '-c', 'cft test run all --stage init --verbose']
3333

3434
# ----- SUITE simple-composer-env-v2
3535

36-
- id: init-simple-composer-env-v2
37-
waitFor:
38-
- create all
39-
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
40-
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV2Module --stage init --verbose']
4136
- id: apply-simple-composer-env-v2
4237
waitFor:
43-
- init-simple-composer-env-v2
38+
- init-all
4439
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
4540
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV2Module --stage apply --verbose']
4641
- id: verify-simple-composer-env-v2
@@ -54,17 +49,12 @@ steps:
5449
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
5550
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV2Module --stage destroy --verbose']
5651

57-
5852
# ----- SUITE composer-v2-sharedvpc-prereq-local
5953

60-
- id: init-composer-v2-sharedvpc-prereq
61-
waitFor:
62-
- destroy-simple-composer-env-v2
63-
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
64-
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV2SharedVpcModule --stage init --verbose']
6554
- id: apply-composer-v2-sharedvpc-prereq
6655
waitFor:
67-
- init-composer-v2-sharedvpc-prereq
56+
- init-all
57+
- destroy-simple-composer-env-v2
6858
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
6959
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV2SharedVpcModule --stage apply --verbose']
7060
- id: verify-composer-v2-sharedvpc-prereq
@@ -78,30 +68,23 @@ steps:
7868
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
7969
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV2SharedVpcModule --stage destroy --verbose']
8070

81-
8271
# ----- SUITE simple-composer-env-v3
8372

84-
- id: init-simple-composer-env-v3
85-
waitFor:
86-
- create all
87-
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
88-
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV3Module --stage init --verbose']
8973
- id: apply-simple-composer-env-v3
9074
waitFor:
91-
- init-simple-composer-env-v3
75+
- init-all
9276
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
93-
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV3Module --stage apply --verbose']
94-
- id: verify-simple-composer-env-v3
77+
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV2Module --stage apply --verbose']
78+
- id: verify-simple-composer-env-v2
9579
waitFor:
9680
- apply-simple-composer-env-v3
9781
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
98-
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV3Module --stage verify --verbose']
99-
- id: destroy-simple-composer-env-v3
82+
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV2Module --stage verify --verbose']
83+
- id: destroy-simple-composer-env-v2
10084
waitFor:
10185
- verify-simple-composer-env-v3
10286
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
103-
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV3Module --stage destroy --verbose']
104-
87+
args: ['/bin/bash', '-c', 'cft test run TestSimpleComposerEnvV2Module --stage destroy --verbose']
10588

10689
tags:
10790
- 'ci'

examples/simple_composer_env_v3/main.tf

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -51,43 +51,10 @@ module "simple-composer-environment" {
5151
environment_size = "ENVIRONMENT_SIZE_SMALL"
5252

5353
use_private_environment = true
54+
enable_private_builds_only = true
5455
cloud_data_lineage_integration = true
5556
resilience_mode = "STANDARD_RESILIENCE"
5657

57-
scheduler = {
58-
cpu = 0.5
59-
memory_gb = 1
60-
storage_gb = 1
61-
count = 2
62-
}
63-
64-
dag_processor = {
65-
cpu = 0.5
66-
memory_gb = 1
67-
storage_gb = 1
68-
count = 2
69-
}
70-
71-
web_server = {
72-
cpu = 0.5
73-
memory_gb = 1
74-
storage_gb = 1
75-
}
76-
77-
worker = {
78-
cpu = 0.5
79-
memory_gb = 1
80-
storage_gb = 1
81-
min_count = 2
82-
max_count = 3
83-
}
84-
85-
triggerer = {
86-
cpu = 1
87-
memory_gb = 1
88-
count = 2
89-
}
90-
9158
scheduled_snapshots_config = {
9259
enabled = true
9360
snapshot_location = google_storage_bucket.my_bucket.url
@@ -96,7 +63,7 @@ module "simple-composer-environment" {
9663
}
9764

9865
maintenance_start_time = "2025-02-01T00:00:00Z"
99-
maintenance_end_time = "2025-03-01T12:00:00Z"
66+
maintenance_end_time = "2025-05-01T12:00:00Z"
10067
maintenance_recurrence = "FREQ=WEEKLY;BYDAY=SU,SA"
10168

10269
depends_on = [

modules/create_environment_v3/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ module "simple-composer-environment" {
7070
| composer\_service\_account | Service Account for running Cloud Composer. | `string` | `null` | no |
7171
| create\_network\_attachment | Either create a new network attachment or use existing one. If true, provide the subnet details. | `bool` | `true` | no |
7272
| dag\_processor | Configuration for resources used by Airflow workers. | <pre>object({<br> cpu = string<br> memory_gb = number<br> storage_gb = number<br> count = number<br> })</pre> | <pre>{<br> "count": 2,<br> "cpu": 2,<br> "memory_gb": 7.5,<br> "storage_gb": 5<br>}</pre> | no |
73+
| enable\_private\_builds\_only | If true, builds performed during operations that install Python packages have only private connectivity to Google services. If false, the builds also have access to the internet. | `bool` | `false` | no |
7374
| env\_variables | Variables of the airflow environment. | `map(string)` | `{}` | no |
7475
| environment\_size | The environment size controls the performance parameters of the managed Cloud Composer infrastructure that includes the Airflow database. Values for environment size are: `ENVIRONMENT_SIZE_SMALL`, `ENVIRONMENT_SIZE_MEDIUM`, and `ENVIRONMENT_SIZE_LARGE`. | `string` | `"ENVIRONMENT_SIZE_MEDIUM"` | no |
7576
| grant\_sa\_agent\_permission | Cloud Composer relies on Workload Identity as Google API authentication mechanism for Airflow. | `bool` | `true` | no |
76-
| image\_version | The version of the aiflow running in the cloud composer environment. | `string` | `"composer-3-airflow-2.10.2-build.5"` | no |
77+
| image\_version | The version of the aiflow running in the cloud composer environment. | `string` | `"composer-3-airflow-2.10.2-build.7"` | no |
7778
| kms\_key\_name | Customer-managed Encryption Key fully qualified resource name, i.e. projects/project-id/locations/location/keyRings/keyring/cryptoKeys/key. | `string` | `null` | no |
7879
| labels | The resource labels (a map of key/value pairs) to be applied to the Cloud Composer. | `map(string)` | `{}` | no |
7980
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `null` | no |

modules/create_environment_v3/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ resource "google_composer_environment" "composer_env" {
3838
config {
3939

4040
enable_private_environment = var.use_private_environment # reusing the existing variable name from previous versions
41+
enable_private_builds_only = var.enable_private_builds_only
4142

4243
environment_size = var.environment_size
4344
resilience_mode = var.resilience_mode

modules/create_environment_v3/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ variable "env_variables" {
9797
variable "image_version" {
9898
type = string
9999
description = "The version of the aiflow running in the cloud composer environment."
100-
default = "composer-3-airflow-2.10.2-build.5"
100+
default = "composer-3-airflow-2.10.2-build.7"
101101
}
102102

103103
variable "web_server_plugins_mode" {
@@ -118,6 +118,12 @@ variable "use_private_environment" {
118118
default = false
119119
}
120120

121+
variable "enable_private_builds_only" {
122+
type = bool
123+
description = "If true, builds performed during operations that install Python packages have only private connectivity to Google services. If false, the builds also have access to the internet."
124+
default = false
125+
}
126+
121127
variable "maintenance_start_time" {
122128
description = "Time window specified for daily or recurring maintenance operations in RFC3339 format"
123129
type = string

0 commit comments

Comments
 (0)