-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from terraform-google-modules/feature/initial-i…
…mplementation Initial module implementation
- Loading branch information
Showing
49 changed files
with
2,778 additions
and
1 deletion.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @morgante @aaron-lane @Jberlinsky @adrienthebo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# OSX leaves these everywhere on SMB shares | ||
._* | ||
|
||
# OSX trash | ||
.DS_Store | ||
|
||
# Python | ||
*.pyc | ||
|
||
# Emacs save files | ||
*~ | ||
\#*\# | ||
.\#* | ||
|
||
# Vim-related files | ||
[._]*.s[a-w][a-z] | ||
[._]s[a-w][a-z] | ||
*.un~ | ||
Session.vim | ||
.netrwhist | ||
|
||
### https://raw.github.com/github/gitignore/90f149de451a5433aebd94d02d11b0e28843a1af/Terraform.gitignore | ||
|
||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
|
||
# Kitchen files | ||
**/inspec.lock | ||
**/.kitchen | ||
**/.kitchen.local.yml | ||
**/Gemfile.lock | ||
|
||
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most | ||
# .tfvars files are managed as part of configuration and so should be included in | ||
# version control. | ||
# | ||
# example.tfvars | ||
**/terraform.tfvars | ||
|
||
credentials.json | ||
|
||
test/fixtures/*/ssh/key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright 2018 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
driver: | ||
name: "terraform" | ||
command_timeout: 1800 | ||
|
||
provisioner: | ||
name: "terraform" | ||
|
||
platforms: | ||
- name: local | ||
|
||
suites: | ||
- name: "simple_example" | ||
lifecycle: | ||
pre_create: | ||
- ./test/fixtures/all_examples/build_image.sh simple_example | ||
driver: | ||
name: "terraform" | ||
command_timeout: 1800 | ||
root_module_directory: test/fixtures/simple_example | ||
verifier: | ||
name: terraform | ||
color: false | ||
systems: | ||
- name: simple_example | ||
backend: gcp | ||
shell: true | ||
controls: | ||
- gcloud | ||
- name: jenkins | ||
backend: ssh | ||
controls: | ||
- jenkins | ||
hosts_output: jenkins_instance_public_ip | ||
key_files: | ||
- ./test/fixtures/simple_example/ssh/key | ||
user: user | ||
provisioner: | ||
name: terraform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.5.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this | ||
project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## [Unreleased] | ||
### Changed | ||
|
||
## [v0.1.0] - 2018-12-20 | ||
|
||
### Added | ||
|
||
* Initial release of module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2018 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ruby '~> 2.5' | ||
|
||
source 'https://rubygems.org/' do | ||
gem 'kitchen-terraform', '~> 4.0' | ||
gem 'nokogiri', '~> 1.8' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# Copyright 2018 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Make will use bash instead of sh | ||
SHELL := /usr/bin/env bash | ||
|
||
# Docker build config variables | ||
CREDENTIALS_PATH ?= /cft/workdir/credentials.json | ||
DOCKER_ORG := gcr.io/cloud-foundation-cicd | ||
DOCKER_TAG_BASE_KITCHEN_TERRAFORM ?= 0.11.10_216.0.0_1.19.1_0.1.10 | ||
DOCKER_REPO_BASE_KITCHEN_TERRAFORM := ${DOCKER_ORG}/cft/kitchen-terraform:${DOCKER_TAG_BASE_KITCHEN_TERRAFORM} | ||
DOCKER_TAG_KITCHEN_TERRAFORM ?= ${DOCKER_TAG_BASE_KITCHEN_TERRAFORM} | ||
DOCKER_IMAGE_KITCHEN_TERRAFORM := cft/kitchen-terraform_terraform-google-jenkins-gce | ||
|
||
# All is the first target in the file so it will get picked up when you just run 'make' on its own | ||
all: check_shell check_python check_golang check_terraform check_docker check_base_files test_check_headers check_headers check_trailing_whitespace generate_docs | ||
|
||
# The .PHONY directive tells make that this isn't a real target and so | ||
# the presence of a file named 'check_shell' won't cause this target to stop | ||
# working | ||
.PHONY: check_shell | ||
check_shell: | ||
@source test/make.sh && check_shell | ||
|
||
.PHONY: check_python | ||
check_python: | ||
@source test/make.sh && check_python | ||
|
||
.PHONY: check_golang | ||
check_golang: | ||
@source test/make.sh && golang | ||
|
||
.PHONY: check_terraform | ||
check_terraform: | ||
@source test/make.sh && check_terraform | ||
|
||
.PHONY: check_docker | ||
check_docker: | ||
@source test/make.sh && docker | ||
|
||
.PHONY: check_base_files | ||
check_base_files: | ||
@source test/make.sh && basefiles | ||
|
||
.PHONY: check_shebangs | ||
check_shebangs: | ||
@source test/make.sh && check_bash | ||
|
||
.PHONY: check_trailing_whitespace | ||
check_trailing_whitespace: | ||
@source test/make.sh && check_trailing_whitespace | ||
|
||
.PHONY: test_check_headers | ||
test_check_headers: | ||
@echo "Testing the validity of the header check" | ||
@python test/test_verify_boilerplate.py | ||
|
||
.PHONY: check_headers | ||
check_headers: | ||
@echo "Checking file headers" | ||
@python test/verify_boilerplate.py | ||
|
||
# Integration tests | ||
.PHONY: test_integration | ||
test_integration: | ||
bundle install | ||
bundle exec kitchen create | ||
bundle exec kitchen converge | ||
bundle exec kitchen converge | ||
bundle exec kitchen verify | ||
bundle exec kitchen destroy | ||
|
||
.PHONY: generate_docs | ||
generate_docs: | ||
@source test/make.sh && generate_docs | ||
|
||
# Versioning | ||
.PHONY: version | ||
version: | ||
@source helpers/version-repo.sh | ||
|
||
# Build Docker | ||
.PHONY: docker_build_kitchen_terraform | ||
docker_build_kitchen_terraform: | ||
docker build -f build/docker/kitchen_terraform/Dockerfile \ | ||
--build-arg BASE_IMAGE=${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \ | ||
-t ${DOCKER_IMAGE_KITCHEN_TERRAFORM}:${DOCKER_TAG_KITCHEN_TERRAFORM} . | ||
|
||
# Push Docker image | ||
.PHONY: docker_push_kitchen_terraform | ||
docker_push_kitchen_terraform: | ||
docker tag ${DOCKER_IMAGE_KITCHEN_TERRAFORM}:${DOCKER_TAG_KITCHEN_TERRAFORM} ${DOCKER_ORG}/${DOCKER_IMAGE_KITCHEN_TERRAFORM}:${DOCKER_TAG_KITCHEN_TERRAFORM} | ||
docker push ${DOCKER_ORG}/${DOCKER_IMAGE_KITCHEN_TERRAFORM}:${DOCKER_TAG_KITCHEN_TERRAFORM} | ||
|
||
# Run docker | ||
.PHONY: docker_run | ||
docker_run: | ||
docker run --rm -it \ | ||
-e CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=${CREDENTIALS_PATH} \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_IMAGE_KITCHEN_TERRAFORM}:${DOCKER_TAG_KITCHEN_TERRAFORM} \ | ||
/bin/bash | ||
|
||
.PHONY: docker_create | ||
docker_create: | ||
docker run --rm -it \ | ||
-e CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=${CREDENTIALS_PATH} \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_IMAGE_KITCHEN_TERRAFORM}:${DOCKER_TAG_KITCHEN_TERRAFORM} \ | ||
/bin/bash -c "kitchen create" | ||
|
||
.PHONY: docker_converge | ||
docker_converge: | ||
docker run --rm -it \ | ||
-e CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=${CREDENTIALS_PATH} \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_IMAGE_KITCHEN_TERRAFORM}:${DOCKER_TAG_KITCHEN_TERRAFORM} \ | ||
/bin/bash -c "kitchen converge" | ||
|
||
.PHONY: docker_verify | ||
docker_verify: | ||
docker run --rm -it \ | ||
-e CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=${CREDENTIALS_PATH} \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_IMAGE_KITCHEN_TERRAFORM}:${DOCKER_TAG_KITCHEN_TERRAFORM} \ | ||
/bin/bash -c "kitchen verify" | ||
|
||
.PHONY: docker_destroy | ||
docker_destroy: | ||
docker run --rm -it \ | ||
-e CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=${CREDENTIALS_PATH} \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_IMAGE_KITCHEN_TERRAFORM}:${DOCKER_TAG_KITCHEN_TERRAFORM} \ | ||
/bin/bash -c "kitchen destroy" | ||
|
||
.PHONY: test_integration_docker | ||
test_integration_docker: docker_create docker_converge docker_verify docker_destroy | ||
@echo "Running test-kitchen tests in docker" |
Oops, something went wrong.