update-tf-provider-for-resource

Backports and aligns KCC's vendored Terraform Google Beta provider code with upstream while preserving local patches.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Updating KCC's vendored Terraform Google Beta provider with upstream HashiCorp changes risks overwriting critical KCC-specific patches (ForceNew overrides, custom flatteners, diff suppressors), which breaks resources at runtime. This Skill provides a safe, step-by-step workflow for backporting upstream changes without losing KRM-specific behavior.

Core Features & Use Cases

  • Patch Discovery & Preservation: Uses git history and keyword searches (KCC, CNRM, KRM, Autogen) to identify local ForceNew overrides, empty-block flatteners, and custom diff suppressors before modifying vendored files.
  • Guided Backporting: Covers two scenarios—backporting new fields (schema, expanders, flatteners) and upgrading immutable fields to mutable with in-place update handlers via GKE/GCP client SDKs.
  • Compilation & CI Validation: Walks through go.work workspace setup, go vet checks, CRD regeneration, and mandatory presubmit scripts (make resource-docs, validate-generated-files, validate-prereqs.sh).
  • Use Case: A GKE field like a node pool setting becomes mutable at the GCP API level. Use this Skill to remove ForceNew, implement the d.HasChange update handler in resource_container_node_pool.go, and validate the change end-to-end.

Quick Start

Ask the agent to backport a specific upstream Terraform Google Beta provider field into KCC's vendored provider under third_party/github.com/hashicorp/terraform-provider-google-beta while preserving all local KCC patches.

Frequently Asked Questions about update-tf-provider-for-resource

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

FAQPage Schema
How do I update KCC's vendored Terraform provider with upstream changes?

Fetch the upstream file from the canonical HashiCorp terraform-provider-google-beta repository, extract the schema, expander, and flattener changes, and merge them into the local vendored file under third_party/. Never overwrite the local file wholesale, as it contains KCC-specific patches.

How do I enable in-place updates for an immutable field in Config Connector?

Remove ForceNew: true from the field's schema definition, then implement a d.HasChange block in the resource update function that builds an update request and sends it via the GKE/GCP client SDK. Verify the GCP API actually supports in-place mutation first.

Why can't I just copy the upstream Terraform provider file into KCC?

KCC's vendored provider contains custom patches enforcing KRM semantics, including ForceNew overrides, empty-block flatteners that prevent false diffs, and diff suppressors for autogenerated GCP attributes. Blindly overwriting reverts these and breaks resources at runtime.

How do I compile and validate vendored Terraform provider changes in KCC?

Uncomment the TPG Beta module in go.work, run go vet scoped to the modified service package, then restore go.work. Afterward regenerate CRDs and run make resource-docs plus the CI presubmit validation scripts.

How do I find KCC-specific patches in a vendored provider file?

Run git log -p on the file to review local modification history, and search for comments containing keywords like KCC, CNRM, KRM, or Autogen. Look for ForceNew: true overrides, custom flatteners returning nil for empty blocks, and KCC-specific diff suppressors.