Giter VIP home page Giter VIP logo

terraform-kms's Introduction

Example showing how to use terraform for Google Key Management Service Resources

Steps:

  • Set variables:
export TF_VAR_gcp_credentials="path/to/credentials/file"
export TF_VAR_gcp_project="gcp-project-name"
export TF_VAR_kms_key_ring_name=""
export TF_VAR_kms_key_name=""
  • Optionally set a region (default is us-central1): export TF_VAR_gcp_region="us-east1"
  • Run terraform commands:
terraform init
terraform plan
terraform apply
  • Cleanup:
terraform destroy
unset TF_VAR_gcp_credentials
unset TF_VAR_gcp_project
  • Manual cleanup of keyring and key: Sometimes a terraform destroy may not be successful of the keyring is already in a destroy scheduled state. In that case the resources will continue to stay around in terraform state file and you may need to remove them manually from the state file. Below are example commands to achieve this: ** Note: please use these commands with care as it will remove resources from terraform management **

    • Make a backup of the tfstate file: cp terraform.tfstate terraform.tfstate.backup.$(date "+%Y%m%d-%H%M%S")
    • Use the commands to display existing resources in state file:
terraform state list
terraform state show google_kms_crypto_key.my_crypto_key
terraform state show google_kms_key_ring.my_key_ring
  • Remove the google_kms_crypto_key resource from state file:
terraform state rm google_kms_crypto_key.my_crypto_key
  • Remove the google_kms_key_ring resource from state file:
terraform state rm google_kms_key_ring.my_key_ring

terraform-kms's People

Contributors

kawsark avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.