test-provider
Shows how to locally test changes to the provider against a real container registry. Use when you made changes and want to see them work end-to-end before opening a PR, or when unit tests pass but you want confidence the provider works in practice, or you're debugging an issue that only reproduces with real registry interactions
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Test local changes to the terraform-provider-ko against a real registry.
Prerequisites
The test uses ttl.sh, a free ephemeral container registry that requires no authentication. Images pushed there expire automatically.
Steps
-
Build the provider and install to local mirror:
go build -o ~/.terraform.d/plugins/registry.terraform.io/ko-build/ko/0.0.100/darwin_arm64/terraform-provider-ko . -
Create a temporary test directory with a minimal Terraform config:
TEST_DIR=$(mktemp -d) cat > "$TEST_DIR/main.tf" << 'EOF' terraform { required_providers { ko = { source = "ko-build/ko" version = "0.0.100" } } } provider "ko" { repo = "ttl.sh/terraform-provider-ko-test" } resource "ko_build" "test" { importpath = "github.com/google/ko" } output "image_ref" { value = ko_build.test.image_ref } EOF echo "Test directory: $TEST_DIR" -
Initialise Terraform:
cd "$TEST_DIR" && rm -f .terraform.lock.hcl && terraform init -
Run terraform plan:
cd "$TEST_DIR" && terraform plan -out tf.out -
If the plan looks good, apply it:
cd "$TEST_DIR" && terraform apply tf.out -
Verify the image was pushed by checking the output shows a valid image reference.
-
Clean up (removes test directory and provider from local mirror):
rm -rf "$TEST_DIR" rm -f ~/.terraform.d/plugins/registry.terraform.io/ko-build/ko/0.0.100/darwin_arm64/terraform-provider-ko
Debugging
To see detailed provider logs, set TF_LOG=TRACE:
cd "$TEST_DIR" && TF_LOG=TRACE terraform apply -auto-approve 2>&1 | tee /tmp/ko-provider-test.log
Then examine the logs:
less /tmp/ko-provider-test.log
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-02-04
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!