정보
이 스킬은 자격 증명 해결 체인과 안전한 처리 방식을 포함한 Plugin Framework를 통한 Terraform 프로바이더 인증 구현 패턴을 제공합니다. 프로바이더 스키마 설계, 환경 변수 폴백, 비밀 정보 숨김 처리, 상세한 진단 정보를 다룹니다. 프로바이더 구성 방법과 자격 증명 해결 로직을 구축하거나 디버깅할 때 활용하세요.
빠른 설치
Claude Code
추천npx skills add hashicorp/agent-skills -a claude-code/plugin add https://github.com/hashicorp/agent-skillsgit clone https://github.com/hashicorp/agent-skills.git ~/.claude/skills/provider-configurationClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
Terraform Provider Configuration and Authentication
How a provider accepts connection settings and resolves credentials. Poor
authentication UX is the first thing every user of a provider hits; a
well-designed credential provider chain is what separates a production-grade
provider from a demo. The examples use a fictional examplecloud provider
and the Plugin Framework.
References (load when needed):
references/credential-chain.md— complete, compilable credential chain implementation (providers, chain, file profiles, Configure wiring, tests)references/case-studies.md— how the AWS provider (aws-sdk-go-base) and smaller providers structure real credential chains
Provider Schema for Authentication
Every authentication attribute must be Optional, never Required — a
Required attribute forces users to put credentials in configuration and
makes environment-variable and credentials-file resolution impossible. Mark
secrets Sensitive so Terraform redacts them in plan output, and state the
environment-variable fallback in each description so tfplugindocs publishes
the resolution rules.
func (p *examplecloudProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
"endpoint": schema.StringAttribute{
Optional: true,
MarkdownDescription: "API endpoint. May also be set via the `EXAMPLECLOUD_ENDPOINT` environment variable.",
},
"api_key": schema.StringAttribute{
Optional: true,
MarkdownDescription: "API key. May also be set via the `EXAMPLECLOUD_API_KEY` environment variable, or in a shared credentials file.",
},
"api_secret": schema.StringAttribute{
Optional: true,
Sensitive: true,
MarkdownDescription: "API secret. May also be set via the `EXAMPLECLOUD_API_SECRET` environment variable, or in a shared credentials file.",
},
"profile": schema.StringAttribute{
Optional: true,
MarkdownDescription: "Named profile in the shared credentials file. May also be set via the `EXAMPLECLOUD_PROFILE` environment variable. Defaults to `default`.",
},
"skip_credentials_validation": schema.BoolAttribute{
Optional: true,
MarkdownDescription: "Skip the identity check normally performed during provider configuration.",
},
},
}
}
Never add a Default to a credential attribute, and never hardcode a
credential anywhere in the provider. Defaults belong in the resolution logic
(where environment variables and files can override them), not in the schema.
The Credential Provider Chain
Resolve credentials by consulting an ordered list of sources and taking the
first one that produces a complete set. This is the pattern the AWS
provider uses via aws-sdk-go-base,
and it generalizes to any provider. The canonical precedence, highest first:
- Static configuration — values set directly in the
providerblock. Explicit always wins. - Environment variables —
EXAMPLECLOUD_API_KEY, etc. The CI-friendly path. - Shared credentials file — named profiles in
~/.examplecloud/credentials, for humans with multiple accounts. - Platform identity — instance metadata, workload identity, or OIDC token exchange, where the platform offers it. Credentials nobody has to store.
Two rules make the chain predictable:
- Resolve secrets as a set, not field-by-field. If the environment supplies an API key but no secret, that source offers nothing — fall through to the next source for both values. Mixing an env-var key with a file-profile secret produces authentication failures that are nearly impossible for users to debug.
- Resolve non-secret connection settings field-by-field.
endpoint,profile, orinsecurecan each independently follow config > env > file > default, because a mismatch there is visible and harmless.
The core abstraction is a single-method interface with a sentinel error that distinguishes "this source has nothing to offer" (fall through) from "this source is misconfigured" (surface it):
// ErrNoCredentials signals a source had nothing to offer. The chain falls
// through to the next source. Any other error means the source was
// configured but unusable (e.g. malformed credentials file) and is
// preserved so the final diagnostics can surface it.
var ErrNoCredentials = errors.New("no credentials found")
type Credentials struct {
APIKey string
APISecret string
Source string // which provider supplied them, for logging
}
func (c Credentials) Complete() bool {
return c.APIKey != "" && c.APISecret != ""
}
type Provider interface {
Retrieve(ctx context.Context) (Credentials, error)
Name() string
}
A Chain (itself a Provider, so chains compose) walks the providers in
order and returns the first complete set of credentials. Every skipped
source is recorded into an aggregate ChainError whose Error() lists each
source with the reason it was skipped, and whose Is method makes
errors.Is(err, ErrNoCredentials) true only when every source fell through
cleanly — so Configure can tell "nothing supplied" from "something
supplied but broken" with one check. The full implementation — the chain
loop, the static, environment, and file providers, and the
NewDefaultChain constructor that owns the canonical order — lives in
references/credential-chain.md.
Wiring the Chain into Configure
Configure runs once per Terraform operation, before any resource CRUD.
The shape:
func (p *examplecloudProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) {
var config examplecloudProviderModel
resp.Diagnostics.Append(req.Config.Get(ctx, &config)...)
if resp.Diagnostics.HasError() {
return
}
// 1. Guard against unknown values (e.g. api_key = some_resource.output).
if config.APIKey.IsUnknown() {
resp.Diagnostics.AddAttributeError(
path.Root("api_key"),
"Unknown API Key",
"The provider cannot connect because api_key depends on a value known only after apply. "+
"Set a static value, or use the EXAMPLECLOUD_API_KEY environment variable.",
)
}
// ... repeat for each auth attribute, then:
if resp.Diagnostics.HasError() {
return
}
// 2. Resolve credentials through the chain.
chain := credentials.NewDefaultChain(
config.APIKey.ValueString(),
config.APISecret.ValueString(),
credentials.Options{Profile: config.Profile.ValueString()},
)
creds, err := chain.Retrieve(ctx)
if err != nil {
if errors.Is(err, credentials.ErrNoCredentials) {
resp.Diagnostics.AddError(
"No Valid Credential Sources Found",
"No examplecloud credentials were found. Sources tried, in order:\n\n"+err.Error()+
"\n\nSet api_key and api_secret in the provider block, export "+
"EXAMPLECLOUD_API_KEY and EXAMPLECLOUD_API_SECRET, or add a profile to "+
"~/.examplecloud/credentials. See https://example.com/docs/auth.",
)
} else {
resp.Diagnostics.AddError("Failed to Resolve Credentials", err.Error())
}
return
}
tflog.Debug(ctx, "resolved credentials", map[string]any{"source": creds.Source})
// 3. Build the client once; share it with every resource and data source.
client := examplecloud.NewClient(endpoint, creds.APIKey, creds.APISecret)
resp.DataSourceData = client
resp.ResourceData = client
}
Why each step matters:
- Unknown-value guards. During planning, an attribute wired to another resource's output is unknown, not null. Without the guard the provider silently treats it as empty, falls through the chain, and authenticates as the wrong identity — or fails with a misleading "missing credentials" error. Name the environment-variable workaround in the guard message.
- The sentinel check picks the right message. "You gave me nothing" (actionable list of options) is a different failure from "you gave me something broken" (show the parse error). Collapsing them into one message is how providers end up with users pasting secrets into config to debug.
- Log the source, never the secret. Knowing which source won is the single most useful debugging fact and costs nothing to log.
Diagnostics That Unblock Users
An authentication error message is the provider's most-read documentation. Every credential failure diagnostic should name:
- Every source tried, in order, with why it was skipped — the
ChainErrorprovides this.aws-sdk-go-basedoes the same with itsNoValidCredentialSourcesError. - The exact environment variable names and the credentials file path and profile that were consulted — not "set the appropriate environment variables".
- A documentation URL for the provider's authentication guide.
Use warnings (not errors) for conditions that are suspicious but not fatal,
naming what took precedence: a profile set while environment credentials
are also present (which wins?), or a credentials file with group/world-read
permissions (suggest chmod 0600).
Secret Hygiene
- Give the
CredentialstypeString()andGoString()methods that redact secret fields, so a stray%v,%+v, or error wrap can never leak a secret into logs or diagnostics. - Never include credential values in diagnostics, log lines, or wrapped errors — log the source name and non-secret identifiers only.
- Warn when a credentials file is readable by other users
(
info.Mode().Perm()&0o077 != 0); skip this check on Windows, where POSIX permission bits are not meaningful.
Configure-Time Validation
Resolve the chain eagerly in Configure — never lazily on first resource
use — so a credentials problem fails one time, at plan, with a good message,
instead of failing in the middle of an apply. If the API has a cheap
identity endpoint (the equivalent of AWS sts:GetCallerIdentity or a
/whoami), call it after resolving credentials so invalid (not just
missing) credentials also fail at configure time. Gate it behind a
skip_credentials_validation attribute for air-gapped or stubbed
environments.
Unit Testing the Chain
The chain is pure logic — test it with unit tests (Test prefix, no
TF_ACC), not acceptance tests. Make the environment injectable (a
getenv func(string) string field defaulting to os.Getenv, or use
t.Setenv) and point the file provider at t.TempDir() fixtures. The
tests that matter:
- Per-source: each provider returns its credentials when set and
ErrNoCredentialswhen incomplete (a key with no secret is incomplete). - Precedence: static beats env; env beats file; chain falls through to the file when nothing above supplies a complete set.
- Failure aggregation: with all sources empty,
errors.Is(err, ErrNoCredentials)is true and the message names every source. - Hard errors: a malformed credentials file or an explicitly requested profile that does not exist surfaces a descriptive error rather than silently falling through (a merely defaulted profile falls through).
- Redaction:
fmt.Sprintf("%v")and%+vof aCredentialsvalue never contain the secret.
Full test examples are in references/credential-chain.md.
Checklist
- All auth attributes
Optional; secrets markedSensitive: true - Attribute descriptions name their environment-variable fallbacks
- Unknown-value guards on every auth attribute in
Configure - Chain precedence: static config > env vars > credentials file > platform identity
- Secrets resolved as a complete set; non-secret settings field-by-field
- Sentinel
ErrNoCredentialsdistinguishes fall-through from hard failure - Missing-credentials diagnostic lists every source tried + docs URL
-
Credentialstype redacts secrets inString()/GoString() - Credentials-file permission warning (non-Windows)
- Eager resolution in
Configure; optional identity check withskip_credentials_validation - Unit tests cover per-source behavior, precedence, aggregation, redaction
- No credential value ever logged or embedded in an error
Related Skills
Use the new-terraform-provider skill (if available) to scaffold the
provider this configuration lives in, and the provider-resources skill for
consuming the configured client from resources and data sources.
GitHub 저장소
자주 묻는 질문
provider-configuration Skill이란 무엇인가요?
provider-configuration은(는) hashicorp이(가) 만든 Claude Skill입니다. Skill은 Claude가 필요할 때 불러오는 지침과 리소스를 묶어 추가 프롬프트 없이 provider-configuration 관련 작업을 수행할 수 있게 합니다.
provider-configuration은(는) 어떻게 설치하나요?
이 페이지의 설치 명령을 사용하세요. provider-configuration을(를) Claude Code 플러그인으로 추가하거나 저장소를 skills 디렉터리에 복제한 다음 Claude를 다시 시작해 Skill을 불러옵니다.
provider-configuration은(는) 어떤 카테고리에 속하나요?
provider-configuration은(는) 테스팅 카테고리에 속합니다.
provider-configuration은(는) 무료로 사용할 수 있나요?
네. provider-configuration은(는) AIMCP에 등록되어 있으며 무료로 설치할 수 있습니다.
연관 스킬
이 Claude Skill은 MMLU, GSM8K를 포함한 60개 이상의 표준화된 학술 과제에서 LLM 성능을 벤치마크하기 위해 lm-evaluation-harness를 실행합니다. 개발자들이 모델 품질을 비교하고, 학습 진행 상황을 추적하거나 학술 결과를 보고할 수 있도록 설계되었습니다. 이 도구는 HuggingFace와 vLLM 모델을 포함한 다양한 백엔드를 지원합니다.
이 스킬은 cron 표현식을 사용하여 Worker를 스케줄링하기 위한 Cloudflare Cron Triggers 구현에 관한 포괄적인 지식을 제공합니다. 주기적 작업, 유지보수 작업, 자동화된 워크플로우 설정 방법을 다루며, 잘못된 cron 표현식이나 시간대 문제 같은 일반적인 이슈들을 해결하는 방법을 포함합니다. 개발자들은 이를 통해 스케줄된 핸들러 구성, cron 트리거 테스트, Workflows 및 Green Compute와의 연동 작업을 수행할 수 있습니다.
이 Claude Skill은 Python 스크립트를 통해 로컬 웹 애플리케이션을 테스트하기 위한 Playwright 기반 툴킷을 제공합니다. 프론트엔드 검증, UI 디버깅, 스크린샷 캡처, 로그 확인 기능을 지원하며 서버 라이프사이클을 관리합니다. 브라우저 자동화 작업에 사용하되 컨텍스트 오염을 방지하기 위해 소스 코드를 읽지 않고 스크립트를 직접 실행하세요.
이 스킬은 테스트 통과를 확인한 후 체계적인 통합 옵션을 제시하여 개발자가 완성된 작업을 마무리하도록 돕습니다. 구현이 완료된 후 머지, PR 생성, 브랜치 정리와 같은 워크플로우를 안내합니다. 코드가 준비되고 테스트가 완료되었을 때 개발 프로세스를 체계적으로 마무리하기 위해 사용하세요.
