Skip to content

feat: add provider-configuration skill for provider auth and credential chains - #78

Open
AdamTylerLynch wants to merge 1 commit into
hashicorp:mainfrom
AdamTylerLynch:feat/provider-configuration-skill
Open

feat: add provider-configuration skill for provider auth and credential chains#78
AdamTylerLynch wants to merge 1 commit into
hashicorp:mainfrom
AdamTylerLynch:feat/provider-configuration-skill

Conversation

@AdamTylerLynch

Copy link
Copy Markdown
Contributor

Adds a new provider-configuration skill to terraform-provider-development, filling
the plugin's largest gap: nothing currently covers a provider's Configure() method,
provider schema for authentication, or credential resolution — the first thing every
provider author has to build and the first thing every provider user hits.

What the skill teaches

  • Provider schema for auth: all auth attributes Optional (never Required, so env
    fallback works), secrets Sensitive: true, descriptions naming the env-var fallback
  • The credential provider chain pattern: a one-method Provider interface, a
    sentinel ErrNoCredentials distinguishing "nothing to offer, fall through" from
    "source misconfigured, surface it", and an aggregate ChainError that lists every
    source tried — with canonical precedence static config > environment variables >
    shared credentials file (profiles) > platform identity
  • Resolving secrets as a complete set (never mixing an env key with a file secret)
    while resolving non-secret settings field-by-field
  • Unknown-value guards in Configure(), secret redaction via String()/GoString(),
    credentials-file permission warnings, and eager configure-time validation with a
    skip_credentials_validation escape hatch
  • Unit testing the chain hermetically (injectable env getter, t.TempDir() fixtures)

Files

  • skills/provider-configuration/SKILL.md (317 lines)
  • skills/provider-configuration/references/credential-chain.md — a complete,
    self-contained implementation for a fictional examplecloud provider
  • skills/provider-configuration/references/case-studies.md — the
    hashicorp/aws-sdk-go-base chain (static short-circuit → SDK default chain →
    web-identity override → assume-role wrapping, NoValidCredentialSourcesError,
    GetCallerIdentity validation) and a generalized small-provider hand-rolled design
  • Registers the skill in terraform/README.md, AGENTS.md, CHANGELOG.md

Verification

  • All Go code blocks in references/credential-chain.md were extracted into a scratch
    module: go build ./..., go vet ./..., and go test ./... all pass (precedence,
    aggregation, hard-error, and redaction tests included)
  • scripts/validate-structure.sh passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant