You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: composer/workflows/terraform_sample/README.md
+12-4Lines changed: 12 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,22 @@ This sample demonstrates how to run Terraform configurations directly within an
10
10
-`../terraform_apply_operator_test.py`: Unit tests for the operator.
11
11
-`main.tf`: Example Terraform configuration that provisions a Google Cloud Storage bucket with labels.
12
12
13
-
## Prerequisites
13
+
## Execution Approaches & Security
14
14
15
-
1. A Google Cloud project with the Cloud Composer API enabled.
16
-
2. A Cloud Composer 2 / 3 environment.
17
-
3. IAM permissions: Ensure the Cloud Composer environment service account has appropriate IAM roles (e.g. `roles/storage.admin`) to provision the desired resources.
15
+
### 1. Pre-installed Binary (Recommended for Private IP Environments)
16
+
In enterprise Cloud Composer environments with Private IP (no direct internet egress) or custom worker images, you can provide a pre-installed `terraform` binary:
17
+
- Place `terraform` in the system `PATH` (e.g. `/usr/local/bin/terraform`).
18
+
- Or pass `binary_path="/opt/bin/terraform"` to `TerraformApplyOperator`.
19
+
20
+
### 2. Verified Dynamic Download
21
+
If no pre-installed binary is detected, `TerraformApplyOperator` downloads the official HashiCorp release binary and **cryptographically verifies its SHA-256 checksum** against HashiCorp's signed `SHA256SUMS` manifest before extraction and execution.
22
+
23
+
### 3. Containerized Alternative
24
+
For workloads requiring dedicated execution environments with complex provider dependencies, consider executing Terraform in an isolated container using `GKEStartPodOperator` or `KubernetesPodOperator`.
18
25
19
26
## Deploying to Cloud Composer
20
27
28
+
21
29
1. Copy `terraform_apply_operator.py`, `terraform_dag.py`, and the `terraform_sample/` directory into your Cloud Composer environment's `dags/` folder (or sync via Cloud Storage `gs://<your-composer-bucket>/dags/`).
22
30
2. Update the `PROJECT_ID` variable in `terraform_dag.py` with your GCP project ID.
23
31
3. Trigger the `composer_terraform_apply_dag` from the Airflow web UI.
0 commit comments