update-terraform-fields

Guides updating Terraform-controller-managed KCC resources and patching the vendored Terraform Google Beta provider.

1.1k|377|Updated Apr 8, 2019
One-click install
npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill update-terraform-fields
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: update-terraform-fields
Source: https://github.com/GoogleCloudPlatform/k8s-config-connector/tree/main/.gemini/skills/update-terraform-fields
Command: npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill update-terraform-fields

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding or updating fields on Config Connector resources managed by the legacy Terraform controller requires coordinated changes across service mappings, Go types, the vendored Terraform provider, CRDs, and generated docs, which is error-prone without a clear procedure.

Core Features & Use Cases

  • Codebase Discovery: Locates the Terraform resource name via service mappings and verifies the controller mode in static_config.go before making changes.
  • Provider Patching: Patches the vendored Terraform Google Beta provider under third_party/ with schema, expander, and flattener updates, including ForceNew flattening pitfalls.
  • CRD & Docs Regeneration: Handles both resources with and without Go types, regenerating CRDs, mappers, and resource reference documentation.
  • Use Case: Add a new field like enforceInTransit to PubSubTopic by patching the provider, updating apis/ Go types, regenerating manifests, and running the full E2E fixture presubmit suite.

Quick Start

Use this skill to add a new field to a Terraform-controller-managed Config Connector resource and regenerate all required artifacts.

Frequently Asked Questions about update-terraform-fields

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new field to a Config Connector Terraform-based resource?

First locate the resource in config/servicemappings/<service>.yaml to find the Terraform resource name, then patch the vendored provider schema, expander, and flattener. Finally regenerate CRDs with make manifests or generate-types-and-mappers and run make resource-docs.

How do I patch the vendored Terraform Google Beta provider in k8s-config-connector?

Edit files under third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/services/<service>/, updating the schema map plus expander and flattener functions. Verify compilation with go vet on the third_party path and stage the changes with git add.

Does the Terraform controller need service mapping updates for resource references?

Yes, even when a resource has Go types in apis/, resource reference fields must be declared under resourceReferences in config/servicemappings/<service>.yaml. The TF controller relies on these mappings to translate reference fields to the Terraform schema.

Why does a oneOf validation error occur during fixture updates?

Legacy resources exempted from Server-Side Apply in tests/e2e/ratcheting.go create objects with a legacy Create call, leaving old oneOf fields unmanaged during SSA updates. Remove the resource from the exempted list so both create and update use SSA.

What presubmit checks must run before submitting field changes?

Run make resource-docs, dev/ci/presubmits/validate-generated-files, and scripts/validate-prereqs.sh, plus the full E2E fixture presubmit suite for the affected service. Commit any regenerated CRDs, mappers, docs, or workflow files they produce.