gcp

command
v0.0.0-...-a2cb98e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2024 License: MIT Imports: 18 Imported by: 0

README

Test Data Generators

This directory contains GRPC replay data generators, used for integration testing. This is intentionally does not make use of go generate as it requires non-trivial setup.

Recreating test data

Warning

Always use sandbox projects. Never use these in production or even qa/staging projects.

  • Create a new GCP project. Recreating test data will create KMS resources which have immutable references and can never be destroyed(key material which incurs billing can be destroyed, but not the keyring and key names). If you want to keep KMS/keyrings tidy, create a new project just for this.

  • Setup and Authenticate to Google Cloud via gcloud. If using a Service account, assign following roles.

  • If not already done, enable billing on the project.

  • If not already done, enable KMS APIs.

    gcloud services enable cloudkms.googleapis.com
    
  • Initialize terraform

    terraform -chdir=scripts/gcp init
    
  • Create required KMS Keyring and keys. This keyring must ony be used for integration testing. Keyring name is automatically generated.

    Warning

    This will incur some billing, though it should be less than 0.1$. as long as you destroy it soon after recording grpc responses.

    terraform -chdir=scripts/gcp apply -var="project=<your-sandbox-project-id>"
    
  • Save GRPC responses which can be used for integration tests

    go run scripts/gcp/testdata.go \
        -config scripts/gcp/keys.json \
        -output gcpkms/internal/testdata/
    
  • Destroy all keys in the created keyring.

    terraform -chdir=scripts/gcp destroy -var="project=<your-sandbox-project-id>"
    

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL