Skip to content

Commit a8e5a4e

Browse files
authored
Fix Terraform skill frictions (#103)
Fix Terraform skill to use latest Google provider version Add constraint to force using Developer Connect when creating Cloud Build trigger Fix Terraform skill to use Developer Connect instead of Firebase as GitHub app for DC connection
1 parent cb1bec8 commit a8e5a4e

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

skills/gcp-cicd-terraform/SKILL.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,27 @@ terraform {
3030

3131
Note: The GCS bucket must have Object Versioning enabled to allow recovery from accidental state corruption or overlapping writes.
3232

33+
### Required Provider Version
34+
Use the Google Cloud Terraform provider version 7.20.0 or higher. This skill utilizes features (e.g., Developer Connect) introduced in Google Provider v7.20.0.
35+
36+
```hcl
37+
terraform {
38+
required_version = ">= 1.6.0"
39+
40+
required_providers {
41+
google = {
42+
source = "hashicorp/google"
43+
version = ">= 7.20.0"
44+
}
45+
}
46+
}
47+
```
48+
49+
To retrieve the latest version of the Google provider, use the following command:
50+
```bash
51+
curl -s https://registry.terraform.io/v1/providers/hashicorp/google | jq -r .version
52+
```
53+
3354
## 🛠️ Execution Protocol (Safety First)
3455
The Agent must follow this lifecycle for every infrastructure change to ensure idempotency and prevent production outages:
3556

@@ -88,6 +109,44 @@ To maintain a clean module interface, use the main identifier for singleton reso
88109
- Private Google Access: Subnets should always have private_ip_google_access = true.
89110
- Workload Identity: Prefer GKE Workload Identity over static Service Account JSON keys.
90111

112+
3. Cloud Build Triggers with Developer Connect
113+
When using Developer Connect git repository links, use `developer_connect_event_config` — NOT `repository_event_config`. The `repository_event_config` block is for Cloud Build v2 repository connections and will not work with Developer Connect resources. An example block to create a Cloud Build trigger with Developer Connect git repository link is as follows:
114+
115+
```hcl
116+
resource "google_cloudbuild_trigger" "main" {
117+
developer_connect_event_config {
118+
git_repository_link = google_developer_connect_git_repository_link.main.id
119+
push {
120+
branch = var.trigger_branch
121+
}
122+
}
123+
}
124+
```
125+
126+
4. Developer Connect Connection
127+
When configuring `google_developer_connect_connection`, always set `github_app` to `"DEVELOPER_CONNECT"`. Using `"FIREBASE"` is incorrect and will cause triggers to fail.
128+
129+
```hcl
130+
resource "google_developer_connect_connection" "main" {
131+
location = var.region
132+
connection_id = var.connection_id
133+
project = var.project_id
134+
135+
github_config {
136+
github_app = "DEVELOPER_CONNECT" # CORRECT
137+
authorizer_credential {
138+
oauth_token_secret_version = "" # Populated after manual authorization
139+
}
140+
}
141+
142+
depends_on = [google_project_service.main["developerconnect.googleapis.com"]]
143+
144+
lifecycle {
145+
ignore_changes = [github_config[0].authorizer_credential]
146+
}
147+
}
148+
```
149+
91150
## 📂 Directory Structure
92151
Follow this standard to ensure compatibility with Antigravity (AGY) discovery and Google best practices:
93152

0 commit comments

Comments
 (0)