This is a collection of opinionated submodules that can be used as building blocks to provision VMs in GCP:
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).
- 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: