Terraform Provider

A Go SDK designed to back a Terraform provider — Reconcile() functions, drift detection, immutable fields, and OTel tracing.


A Go SDK designed to back a Terraform provider. The generator emits Reconcile() functions, state diff helpers, and drift detection. Immutable fields and server-managed fields are declared explicitly so the provider never attempts illegal updates.

opensdk: "1.0.0"

openapi:
  $ref: "./spec/openapi.yaml"

sdk:
  name: "infra-api"
  version: "1.0.0"
  license: "MPL-2.0"

languages:
  - language: go
    package:
      name: "github.com/myco/infra-go"
      registry: pkg.go.dev
    style:
      naming: snake_case
      modelNaming: PascalCase
      optionalStyle: pointer
      dateStyle: native
    features:
      auth: oauth2-client-credentials
      retries:
        enabled: true
        maxAttempts: 5
        backoff: exponential
        retryOn: [429, 500, 503]
      reconciliation: terraform
      driftDetection: true
      context: true
      telemetry:
        enabled: true
        traces: true
    additionalProperties:
      generateInterfaces: true   # emit interfaces for mocking in provider tests

codegenRules:
  reconciliation:
    mode: declarative
    ignoreDrift:
      - status        # server-managed; never reconcile
      - createdAt
      - updatedAt
      - etag
    immutableFields:
      - id            # cannot change after creation
      - region
      - accountId
  validation:
    - rule: no-unnamed-operations
      severity: error
    - rule: required-tags
      severity: error
  breakingChangePolicy: major-version-bump
  ignoreFields:
    - __debug
    - _internalOnly

The generated Go SDK will include:

  • ResourceState structs for each resource with mutable/immutable field annotations
  • Reconcile(ctx, desired, actual) functions per resource
  • Diff(ctx, desired, actual) helpers for plan-like preview
  • OTel trace spans wrapping every API call
  • context.Context threaded through every method signature