-
Notifications
You must be signed in to change notification settings - Fork 74
feat: Add Composer v3 sub-module #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
72ef715
feat: initial commit composer v3
prabhu34 4e4dc9d
feat: added examples and tests
prabhu34 682cb64
chore:updated build with v3
prabhu34 dde0c40
chore: added test fixtures
prabhu34 54a51b7
chore: added test fixtures
prabhu34 62d0496
chore: added test fixtures
prabhu34 ecc7d30
chore: added test fixtures
prabhu34 ad06b79
feat: fixed composer 3 env
prabhu34 7e21f44
chore: fix build
prabhu34 ba7eb9c
chore: fix build
prabhu34 f2bba0e
chore: fix build
prabhu34 508958f
chore: fix build
prabhu34 a44706d
chore: fix build
prabhu34 e86345c
chore: readded kitchen tests
prabhu34 506637a
chore: removed tests
prabhu34 bdc933f
feat: updated folder name
prabhu34 219696a
chore: variables corrected
prabhu34 b6ccd2d
chore: variables corrected
prabhu34 8c5cd6c
chore: variables corrected
prabhu34 5d8c9cc
chore: outputs corrected
prabhu34 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Simple Cloud Composer Environment (V3) Example | ||
|
|
||
| This example illustrates how to use the `composer` V2 module to deploy private composer environment with private service connect (PSC) endpoint to connect network attachments. | ||
|
|
||
| This example also creates a Cloud Storage Bucket for scheduled snapshots and assign appropriate permission(s) to Composer Service Account on the bucket. | ||
|
|
||
| <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|:--------:| | ||
| | composer\_env\_name | Name of Cloud Composer Environment. | `string` | `"ci-composer"` | no | | ||
| | composer\_service\_account | Service Account to be used for running Cloud Composer Environment. | `string` | n/a | yes | | ||
| | network | Network where Cloud Composer is created. | `string` | n/a | yes | | ||
| | project\_id | Project ID where Cloud Composer Environment is created. | `string` | n/a | yes | | ||
| | region | Region where Cloud Composer Environment is created. | `string` | n/a | yes | | ||
| | subnetwork | Name of the Subetwork where Cloud Composer is created. | `string` | n/a | yes | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | airflow\_uri | URI of the Apache Airflow Web UI hosted within the Cloud Composer Environment. | | ||
| | composer\_env\_id | ID of Cloud Composer Environment. | | ||
| | composer\_env\_name | Name of the Cloud Composer Environment. | | ||
| | gcs\_bucket | Google Cloud Storage bucket which hosts DAGs for the Cloud Composer Environment. | | ||
|
|
||
| <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
|
|
||
| To provision this example, run the following from within this directory: | ||
| - `terraform init` to get the plugins | ||
| - `terraform plan` to see the infrastructure plan | ||
| - `terraform apply` to apply the infrastructure build | ||
| - `terraform destroy` to destroy the built infrastructure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| /** | ||
| * Copyright 2025 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| resource "random_string" "key_suffix" { | ||
| length = 5 | ||
| special = false | ||
| upper = false | ||
| } | ||
|
|
||
| # Create a bucket to store the snapshots | ||
| resource "google_storage_bucket" "my_bucket" { | ||
| project = var.project_id | ||
| name = "snapshot-bucket-${random_string.key_suffix.result}" | ||
| location = var.region | ||
| force_destroy = true | ||
| uniform_bucket_level_access = true | ||
| } | ||
|
|
||
| resource "google_storage_bucket_iam_member" "object_admin" { | ||
| bucket = google_storage_bucket.my_bucket.name | ||
| role = "roles/storage.objectAdmin" | ||
| member = "serviceAccount:${var.composer_service_account}" | ||
| } | ||
|
|
||
| module "simple-composer-environment" { | ||
| source = "terraform-google-modules/composer/google//modules/create_environment_v3" | ||
| version = "~> 6.0" | ||
|
|
||
| project_id = var.project_id | ||
| composer_env_name = var.composer_env_name | ||
| region = var.region | ||
| composer_service_account = var.composer_service_account | ||
| network = var.network | ||
| subnetwork = var.subnetwork | ||
| create_network_attachment = true | ||
|
|
||
| grant_sa_agent_permission = false | ||
| environment_size = "ENVIRONMENT_SIZE_SMALL" | ||
|
|
||
| use_private_environment = true | ||
| enable_private_builds_only = true | ||
| cloud_data_lineage_integration = true | ||
| resilience_mode = "STANDARD_RESILIENCE" | ||
|
|
||
| scheduled_snapshots_config = { | ||
| enabled = true | ||
| snapshot_location = google_storage_bucket.my_bucket.url | ||
| snapshot_creation_schedule = "0 4 * * *" | ||
| time_zone = "UTC+01" | ||
| } | ||
|
|
||
| maintenance_start_time = "2025-02-01T00:00:00Z" | ||
| maintenance_end_time = "2025-05-01T12:00:00Z" | ||
| maintenance_recurrence = "FREQ=WEEKLY;BYDAY=SU,SA" | ||
|
|
||
| depends_on = [ | ||
| google_storage_bucket_iam_member.object_admin, | ||
| ] | ||
|
|
||
| web_server_network_access_control = [ | ||
| { | ||
| allowed_ip_range = "192.0.2.0/24" | ||
| description = "office net 1" | ||
| }, | ||
| { | ||
| allowed_ip_range = "192.0.4.0/24" | ||
| description = "office net 2" | ||
| }, | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /** | ||
| * Copyright 2025 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| output "composer_env_name" { | ||
| description = "Name of the Cloud Composer Environment." | ||
| value = module.simple-composer-environment.composer_env_name | ||
| } | ||
|
|
||
| output "composer_env_id" { | ||
| description = "ID of Cloud Composer Environment." | ||
| value = module.simple-composer-environment.composer_env_id | ||
| } | ||
|
|
||
| output "gcs_bucket" { | ||
| description = "Google Cloud Storage bucket which hosts DAGs for the Cloud Composer Environment." | ||
| value = module.simple-composer-environment.gcs_bucket | ||
| } | ||
|
|
||
| output "airflow_uri" { | ||
| description = "URI of the Apache Airflow Web UI hosted within the Cloud Composer Environment." | ||
| value = module.simple-composer-environment.airflow_uri | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /** | ||
| * Copyright 2025 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| variable "project_id" { | ||
| description = "Project ID where Cloud Composer Environment is created." | ||
| type = string | ||
| } | ||
|
|
||
| variable "composer_env_name" { | ||
| description = "Name of Cloud Composer Environment." | ||
| default = "ci-composer" | ||
| type = string | ||
| } | ||
|
|
||
| variable "region" { | ||
| description = "Region where Cloud Composer Environment is created." | ||
| type = string | ||
| } | ||
|
|
||
| variable "composer_service_account" { | ||
| description = "Service Account to be used for running Cloud Composer Environment." | ||
| type = string | ||
| } | ||
|
|
||
| variable "network" { | ||
| description = "Network where Cloud Composer is created." | ||
| type = string | ||
| } | ||
|
|
||
| variable "subnetwork" { | ||
| description = "Name of the Subetwork where Cloud Composer is created." | ||
| type = string | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.