Back to list
ko-build

test-provider

by ko-build

Build and deploy Go applications with Terraform

29🍴 16📅 Jan 22, 2026

SKILL.md


name: test-provider description: 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

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

  1. 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 .
    
  2. 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"
    
  3. Initialise Terraform:

    cd "$TEST_DIR" && rm -f .terraform.lock.hcl && terraform init
    
  4. Run terraform plan:

    cd "$TEST_DIR" && terraform plan -out tf.out
    
  5. If the plan looks good, apply it:

    cd "$TEST_DIR" && terraform apply tf.out
    
  6. Verify the image was pushed by checking the output shows a valid image reference.

  7. 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

Score

Total Score

70/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon