Skip to content
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

feat(TPG>=5.14)!: add data_retention_config block #121

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This module is meant for use with Terraform 1.3+ and tested using Terraform 1.3+
Current version is 4.0. Upgrade guides:

- [3.X -> 4.0.](/docs/upgrading_to_v4.0.md)
- [4.X -> 5.0.](/docs/upgrading_to_v5.0.md)

## Usage
Cloud Composer currently has two versions: V2 has greater flexibility in the Airflow core services
Expand Down
6 changes: 6 additions & 0 deletions docs/upgrading_to_v5.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Upgrading to v5.0.0

The v5.0 release contains backwards-incompatible changes.

### TPG max version is bumped to 5.14
This update requires upgrading the minimum provider version to `5.14`.
14 changes: 13 additions & 1 deletion modules/create_environment_v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@

This module is used to create a Cloud Composer V2 environment.

## Compatibility

This module is meant for use with Terraform 1.3+ and tested using Terraform 1.3+. If you find incompatibilities using Terraform >=1.3, please open an issue.

## Version

Current version is 4.0. Upgrade guides:

- [3.X -> 4.0.](/docs/upgrading_to_v4.0.md)
- [4.X -> 5.0.](/docs/upgrading_to_v5.0.md)


```hcl
module "simple-composer-environment" {
source = "terraform-google-modules/composer/google//modules/create_environment_v2"
version = "~> 4.0"
version = "~> 5.0"
project_id = var.project_id
composer_env_name = "test-composer-env"
region = "us-central1"
Expand Down Expand Up @@ -90,6 +101,7 @@ module "simple-composer-environment" {
| subnetwork | The name of the subnetwork to host the composer cluster. | `string` | n/a | yes |
| subnetwork\_region | The subnetwork region of the shared VPC's host (for shared vpc support) | `string` | `""` | no |
| tags | Tags applied to all nodes. Tags are used to identify valid sources or targets for network firewalls. | `set(string)` | `[]` | no |
| task\_logs\_retention\_storage\_mode | The mode of storage for Airflow workers task logs. Values for storage mode are CLOUD\_LOGGING\_ONLY to only store logs in cloud logging and CLOUD\_LOGGING\_AND\_CLOUD\_STORAGE to store logs in cloud logging and cloud storage. Cloud Composer 2.0.23 or newer only | `string` | `null` | no |
| triggerer | Configuration for resources used by Airflow triggerer | <pre>object({<br> cpu = string<br> memory_gb = number<br> count = number<br> })</pre> | `null` | no |
| use\_private\_environment | Create a private environment. | `bool` | `false` | no |
| web\_server | Configuration for resources used by Airflow web server. | <pre>object({<br> cpu = string<br> memory_gb = number<br> storage_gb = number<br> })</pre> | <pre>{<br> "cpu": 2,<br> "memory_gb": 7.5,<br> "storage_gb": 5<br>}</pre> | no |
Expand Down
9 changes: 9 additions & 0 deletions modules/create_environment_v2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ resource "google_composer_environment" "composer_env" {
}
}

dynamic "data_retention_config" {
for_each = var.task_logs_retention_storage_mode == null ? [] : ["data_retention_config"]
content {
task_logs_retention_config {
storage_mode = var.task_logs_retention_storage_mode
}
}
}

}

depends_on = [google_project_iam_member.composer_agent_service_account]
Expand Down
6 changes: 6 additions & 0 deletions modules/create_environment_v2/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,9 @@ variable "kms_key_name" {
type = string
default = null
}

variable "task_logs_retention_storage_mode" {
description = "The mode of storage for Airflow workers task logs. Values for storage mode are CLOUD_LOGGING_ONLY to only store logs in cloud logging and CLOUD_LOGGING_AND_CLOUD_STORAGE to store logs in cloud logging and cloud storage. Cloud Composer 2.0.23 or newer only"
type = string
default = null
}
4 changes: 2 additions & 2 deletions modules/create_environment_v2/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ terraform {

google = {
source = "hashicorp/google"
version = ">= 5.3, < 6"
version = ">= 5.14, < 6"
}

google-beta = {
source = "hashicorp/google-beta"
version = ">= 5.3, < 6"
version = ">= 5.14, < 6"
}
}

Expand Down