-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
1,588 additions
and
1 deletion.
There are no files selected for viewing
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,45 @@ | ||
# 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. | ||
**/*.tfvars | ||
|
||
credentials.json |
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,19 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on | ||
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to | ||
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [0.1.0] - 20XX-YY-ZZ | ||
|
||
### Added | ||
|
||
- Initial release | ||
|
||
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-cloud-storage/compare/v0.1.0...HEAD | ||
[0.1.0]: https://github.com/terraform-google-modules/terraform-google-cloud-storage/releases/tag/v0.1.0 |
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,110 @@ | ||
# Contributing | ||
|
||
This document provides guidelines for contributing to the module. | ||
|
||
## Generating Documentation for Inputs and Outputs | ||
|
||
The Inputs and Outputs tables in the READMEs of the root module, | ||
submodules, and example modules are automatically generated based on | ||
the `variables` and `outputs` of the respective modules. These tables | ||
must be refreshed if the module interfaces are changed. | ||
|
||
### Dependencies | ||
|
||
The following dependencies must be installed on the development system: | ||
|
||
- [make] | ||
- [terraform-docs] v0.6.0 | ||
|
||
### Execution | ||
|
||
Run `make generate_docs` to generate new Inputs and Outputs tables. | ||
|
||
## Integration Testing | ||
|
||
Integration tests are used to verify the behaviour of the root module, | ||
submodules, and example modules. Additions, changes, and fixes should | ||
be accompanied with tests. | ||
|
||
The integration tests are run using [Kitchen][kitchen], | ||
[Kitchen-Terraform][kitchen-terraform], and [InSpec][inspec]. These | ||
tools are packaged within a Docker image for convenience. | ||
|
||
The general strategy for these tests is to verify the behaviour of the | ||
[example modules](./examples), thus ensuring that the root module, | ||
submodules, and example modules are all functionally correct. | ||
|
||
### Dependencies | ||
|
||
The following dependencies must be installed on the development system: | ||
|
||
- [Docker Engine][docker-engine] | ||
- [Google Cloud SDK][google-cloud-sdk] | ||
- [make] | ||
|
||
### Inputs | ||
|
||
Test instances are defined in the | ||
[Kitchen configuration file](./kitchen.yml). The inputs of each Kitchen | ||
instance may be configured with the `driver.variables` key in a | ||
local Kitchen configuration file located at `./kitchen.local.yml` or in | ||
a Terraform variables file located at | ||
`./test/fixtures/<instance>/variables.tfvars`. | ||
|
||
### Credentials | ||
|
||
Download the key of a Service Account with the | ||
[required roles][required-roles] to `./credentials.json`. | ||
|
||
### Interactive Execution | ||
|
||
1. Run `make docker_run` to start the testing Docker container in | ||
interactive mode. | ||
|
||
1. Run `kitchen create <EXAMPLE_NAME>` to initialize the working | ||
directory for an example module. | ||
|
||
1. Run `kitchen converge <EXAMPLE_NAME>` to apply the example module. | ||
|
||
1. Run `kitchen verify <EXAMPLE_NAME>` to test the example module. | ||
|
||
1. Run `kitchen destroy <EXAMPLE_NAME>` to destroy the example module | ||
state. | ||
|
||
### Noninteractive Execution | ||
|
||
Run `make test_integration_docker` to test all of the example modules | ||
noninteractively. | ||
|
||
## Linting and Formatting | ||
|
||
Many of the files in the repository can be linted or formatted to | ||
maintain a standard of quality. | ||
|
||
### Dependencies | ||
|
||
The following dependencies must be installed on the development system: | ||
|
||
- [flake8] | ||
- [gofmt] | ||
- [hadolint] | ||
- [make] | ||
- [shellcheck] | ||
- [Terraform][terraform] v0.11 | ||
|
||
### Execution | ||
|
||
Run `make check`. | ||
|
||
[docker-engine]: https://www.docker.com/products/docker-engine | ||
[flake8]: http://flake8.pycqa.org/en/latest/ | ||
[gofmt]: https://golang.org/cmd/gofmt/ | ||
[google-cloud-sdk]: https://cloud.google.com/sdk/install | ||
[hadolint]: https://github.com/hadolint/hadolint | ||
[inspec]: https://inspec.io/ | ||
[kitchen-terraform]: https://github.com/newcontext-oss/kitchen-terraform | ||
[kitchen]: https://kitchen.ci/ | ||
[make]: https://en.wikipedia.org/wiki/Make_(software) | ||
[shellcheck]: https://www.shellcheck.net/ | ||
[terraform-docs]: https://github.com/segmentio/terraform-docs | ||
[terraform]: https://terraform.io/ |
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,19 @@ | ||
# 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.3' | ||
|
||
source 'https://rubygems.org/' do | ||
gem 'kitchen-terraform', '~> 4.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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
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,148 @@ | ||
# 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. | ||
|
||
# Please note that this file was generated from [terraform-google-module-template](https://github.com/terraform-google-modules/terraform-google-module-template). | ||
# Please make sure to contribute relevant changes upstream! | ||
|
||
# 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 ?= 1.0.1 | ||
DOCKER_REPO_BASE_KITCHEN_TERRAFORM := ${DOCKER_ORG}/cft/kitchen-terraform:${DOCKER_TAG_BASE_KITCHEN_TERRAFORM} | ||
|
||
# All is the first target in the file so it will get picked up when you just run 'make' on its own | ||
.PHONY: all | ||
all: check generate_docs | ||
|
||
# Run all available linters | ||
.PHONY: check | ||
check: check_shell check_python check_golang check_terraform check_docker check_base_files test_check_headers check_headers check_trailing_whitespace | ||
|
||
# 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_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: | ||
@source test/make.sh && check_headers | ||
|
||
# Integration tests | ||
.PHONY: test_integration | ||
test_integration: | ||
test/ci_integration.sh | ||
|
||
.PHONY: generate_docs | ||
generate_docs: | ||
@source test/make.sh && generate_docs | ||
|
||
# Versioning | ||
.PHONY: version | ||
version: | ||
@source helpers/version-repo.sh | ||
|
||
# Run docker | ||
.PHONY: docker_run | ||
docker_run: | ||
docker run --rm -it \ | ||
-e PROJECT_ID \ | ||
-e SERVICE_ACCOUNT_JSON \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \ | ||
/bin/bash -c "source test/ci_integration.sh && setup_environment && exec /bin/bash" | ||
|
||
.PHONY: docker_create | ||
docker_create: | ||
docker run --rm -it \ | ||
-e PROJECT_ID \ | ||
-e SERVICE_ACCOUNT_JSON \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \ | ||
/bin/bash -c "source test/ci_integration.sh && setup_environment && kitchen create" | ||
|
||
.PHONY: docker_converge | ||
docker_converge: | ||
docker run --rm -it \ | ||
-e PROJECT_ID \ | ||
-e SERVICE_ACCOUNT_JSON \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \ | ||
/bin/bash -c "source test/ci_integration.sh && setup_environment && kitchen converge" | ||
|
||
.PHONY: docker_verify | ||
docker_verify: | ||
docker run --rm -it \ | ||
-e PROJECT_ID \ | ||
-e SERVICE_ACCOUNT_JSON \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \ | ||
/bin/bash -c "source test/ci_integration.sh && setup_environment && kitchen verify" | ||
|
||
.PHONY: docker_destroy | ||
docker_destroy: | ||
docker run --rm -it \ | ||
-e PROJECT_ID \ | ||
-e SERVICE_ACCOUNT_JSON \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \ | ||
/bin/bash -c "source test/ci_integration.sh && setup_environment && kitchen destroy" | ||
|
||
.PHONY: test_integration_docker | ||
test_integration_docker: | ||
docker run --rm -it \ | ||
-e PROJECT_ID \ | ||
-e SERVICE_ACCOUNT_JSON \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \ | ||
-v $(CURDIR):/cft/workdir \ | ||
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \ | ||
make test_integration |
Oops, something went wrong.