cloud-platform-tools

module
v0.0.0-...-69e966b Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT

README

Cloud Platform Tool CLI

cp-tools is a command-line tool used by the cloud-platform team to achieve common repetitive tasks against the platform. The resulting binary checks things like:

  • Divergences in terraform states
  • Terraform apply
  • Others

Install

cp-tools can be installed and upgraded by running:

GO111MODULE=on go get github.com/ministryofjustice/cloud-platform-tools/cmd/cp-tools

Usage

For the time being, cp-tools has only one command: cp-tools terraform. In order to execute and use the tools the AWS_* credentials must be provided

cp-tools terraform

cp-tools terraform simply is a terraform wrapper which allows us to execute terraform commands. It also includes check-divergence command which fails in case there are pending terraform changes.

Usage example:

$ cp-tools terraform check-divergence --workspace manager --var-file prod.tfvars
INFO[0000] Executing terraform plan, if there is a drift this program execution will fail  subcommand=check-divergence
INFO[0002] Initializing modules...

Initializing the backend...

Initializing provider plugins...

...
...
...
Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary. 
INFO[0003]                                              
INFO[0015] Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

tls_private_key.worker_key: Refreshing state... [id=1fdf4d57aa5f06668ce94fd60c2a5de657d07de4]
tls_private_key.session_signing_key: Refreshing state... [id=66e5f736b76f51d26d37c1449b21e89066f369d7]
tls_private_key.host_key: Refreshing state... [id=4bf29261ec098ddf34c7d3a45d3b460bd6585ed5]
...
...
...

kubernetes_namespace.concourse: Refreshing state... [id=concourse]
kubernetes_namespace.concourse_main: Refreshing state... [id=concourse-main]
kubernetes_secret.concourse_aws_credentials: Refreshing state... [id=concourse-main/aws-manager]
kubernetes_secret.concourse_basic_auth_credentials: Refreshing state... [id=concourse-main/concourse-basic-auth]

------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed. 

Directories

Path Synopsis
cmd
cp-tools command
pkg

Jump to

Keyboard shortcuts

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