Skip to content

This is a collection of opinionated submodules that can be used to provision VMs in GCP.

License

Notifications You must be signed in to change notification settings

cocktailer/terraform-google-vm

 
 

Repository files navigation

terraform-google-vm

This is a collection of opinionated submodules that can be used as building blocks to provision VMs in GCP:

Compatibility

This module is meant for use with Terraform 0.12. If you haven't upgraded and need a Terraform 0.11.x-compatible version of this module, the last released version intended for Terraform 0.11.x is 0.2.0.

Examples

Examples of how to use these modules can be found in the examples folder.

Project APIs

The following APIs must be enabled on your project:

  • compute.googleapis.com
  • iam.googleapis.com

See also the project_services module (optional).

Notes

distribution_policy_zones cannot be changed during use. If you have changed them yourself or used to have a default value, then you'll have to force recreate a MIG group yourself.

Test Configuration

  1. Create a terraform.tfvars file, using terraform.tfvars.example as an example
cp test/fixtures/shared/terraform.tfvars.example test/fixtures/shared/terraform.tfvars

The terraform.tfvars in each fixture directory is already symlinked to this one shared file.

  1. Populate the variables with values appropriate for your test environment (i.e. project_id, service_account.email)
  2. Download a Service Account key with the necessary permissions and put it in the module's root directory with the name credentials.json.

Running Tests

From the root of the module, run

make test_integration_docker

to build the container and run through all the test suites. Note that this will take some time (> 20 minutes).

You can also run each test case individually and interactively in the Docker container:

make docker_run

The root directory of the module will be mounted to /cft/workdir in the container. For example, to run the mig-autoscaler test suite:

bundle exec kitchen test mig-autosaler

or

bundle exec kitchen create mig-autoscaler
bundle exec kitchen converge mig-autoscaler
bundle exec kitchen verify mig-autoscaler
bundle exec kitchen destroy mig-autoscaler

Permissions

The service account used to execute tests for this module should have the following roles:

About

This is a collection of opinionated submodules that can be used to provision VMs in GCP.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 68.9%
  • Ruby 27.5%
  • Makefile 3.6%