This is a collection of opinionated submodules that can be used as building blocks to provision VMs in GCP:
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 of how to use these modules can be found in the examples folder.
The following APIs must be enabled on your project:
compute.googleapis.com
iam.googleapis.com
See also the project_services module (optional).
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.
- Create a
terraform.tfvars
file, usingterraform.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.
- Populate the variables with values appropriate for your test environment (i.e.
project_id
,service_account.email
) - Download a Service Account key with the necessary permissions and put it in the module's root directory with the name credentials.json.
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
The service account used to execute tests for this module should have the following roles: