Skip to content

Commit ca0dfcc

Browse files
authored
feat(TPG>=5.14)!: add data_retention_config block (#121)
1 parent ba622fa commit ca0dfcc

File tree

6 files changed

+37
-3
lines changed

6 files changed

+37
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This module is meant for use with Terraform 1.3+ and tested using Terraform 1.3+
1515
Current version is 4.0. Upgrade guides:
1616

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

1920
## Usage
2021
Cloud Composer currently has two versions: V2 has greater flexibility in the Airflow core services

docs/upgrading_to_v5.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Upgrading to v5.0.0
2+
3+
The v5.0 release contains backwards-incompatible changes.
4+
5+
### TPG max version is bumped to 5.14
6+
This update requires upgrading the minimum provider version to `5.14`.

modules/create_environment_v2/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@
22

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

5+
## Compatibility
6+
7+
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.
8+
9+
## Version
10+
11+
Current version is 4.0. Upgrade guides:
12+
13+
- [3.X -> 4.0.](/docs/upgrading_to_v4.0.md)
14+
- [4.X -> 5.0.](/docs/upgrading_to_v5.0.md)
15+
516

617
```hcl
718
module "simple-composer-environment" {
819
source = "terraform-google-modules/composer/google//modules/create_environment_v2"
9-
version = "~> 4.0"
20+
version = "~> 5.0"
1021
project_id = var.project_id
1122
composer_env_name = "test-composer-env"
1223
region = "us-central1"
@@ -90,6 +101,7 @@ module "simple-composer-environment" {
90101
| subnetwork | The name of the subnetwork to host the composer cluster. | `string` | n/a | yes |
91102
| subnetwork\_region | The subnetwork region of the shared VPC's host (for shared vpc support) | `string` | `""` | no |
92103
| tags | Tags applied to all nodes. Tags are used to identify valid sources or targets for network firewalls. | `set(string)` | `[]` | no |
104+
| 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 |
93105
| triggerer | Configuration for resources used by Airflow triggerer | <pre>object({<br> cpu = string<br> memory_gb = number<br> count = number<br> })</pre> | `null` | no |
94106
| use\_private\_environment | Create a private environment. | `bool` | `false` | no |
95107
| 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 |

modules/create_environment_v2/main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,15 @@ resource "google_composer_environment" "composer_env" {
206206
}
207207
}
208208

209+
dynamic "data_retention_config" {
210+
for_each = var.task_logs_retention_storage_mode == null ? [] : ["data_retention_config"]
211+
content {
212+
task_logs_retention_config {
213+
storage_mode = var.task_logs_retention_storage_mode
214+
}
215+
}
216+
}
217+
209218
}
210219

211220
depends_on = [google_project_iam_member.composer_agent_service_account]

modules/create_environment_v2/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,9 @@ variable "kms_key_name" {
288288
type = string
289289
default = null
290290
}
291+
292+
variable "task_logs_retention_storage_mode" {
293+
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"
294+
type = string
295+
default = null
296+
}

modules/create_environment_v2/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ terraform {
2020

2121
google = {
2222
source = "hashicorp/google"
23-
version = ">= 5.3, < 6"
23+
version = ">= 5.14, < 6"
2424
}
2525

2626
google-beta = {
2727
source = "hashicorp/google-beta"
28-
version = ">= 5.3, < 6"
28+
version = ">= 5.14, < 6"
2929
}
3030
}
3131

0 commit comments

Comments
 (0)