Skip to content

Commit a9fe558

Browse files
authored
Merge pull request #1 from terraform-google-modules/master
update
2 parents bc07616 + ac32d81 commit a9fe558

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2521
-284
lines changed

.kitchen.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,21 @@ suites:
6464
color: true
6565
systems:
6666
- name: local
67+
attrs_outputs:
68+
customized_inspec_attribute: output_network_name
69+
customized_inspec_attribute: output_network_self_link
70+
customized_inspec_attribute: output_subnets_ips
71+
customized_inspec_attribute: output_routes
72+
customized_inspec_attribute: output_subnets_flow_logs
73+
customized_inspec_attribute: output_subnets_names
74+
customized_inspec_attribute: output_subnets_private_access
75+
customized_inspec_attribute: output_subnets_regions
76+
customized_inspec_attribute: output_subnets_secondary_ranges
77+
customized_inspec_attribute: output_project_id
6778
backend: local
6879
controls:
6980
- gcloud
81+
- inspec_attributes
7082
- name: "multi_vpc"
7183
driver:
7284
name: "terraform"
@@ -106,6 +118,31 @@ suites:
106118
backend: gcp
107119
controls:
108120
- gcp
121+
- name: local
122+
attrs_outputs:
123+
customized_inspec_attribute: output_network_name
124+
customized_inspec_attribute: output_network_self_link
125+
customized_inspec_attribute: output_subnets_ips
126+
customized_inspec_attribute: output_routes
127+
customized_inspec_attribute: output_subnets_flow_logs
128+
customized_inspec_attribute: output_subnets_names
129+
customized_inspec_attribute: output_subnets_private_access
130+
customized_inspec_attribute: output_subnets_regions
131+
customized_inspec_attribute: output_subnets_secondary_ranges
132+
customized_inspec_attribute: output_project_id
133+
backend: local
134+
controls:
135+
- gcloud
136+
- inspec_attributes
137+
- name: "submodule_network_peering"
138+
driver:
139+
name: "terraform"
140+
command_timeout: 1800
141+
root_module_directory: test/fixtures/submodule_network_peering/
142+
verifier:
143+
name: terraform
144+
color: true
145+
systems:
109146
- name: local
110147
backend: local
111148
controls:

CHANGELOG.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,58 @@ and this project adheres to [Semantic Versioning][semver-site].
77

88
## [Unreleased]
99

10+
## [2.0.0] - 2019-12-09
11+
v2.0.0 is a backwards-incompatible release. Please see the [upgrading guide](./docs/upgrading_to_v2.0.md).
12+
13+
### Added
14+
15+
- Split main module up into vpc, subnets, and routes submodules. [#103]
16+
17+
### Fixed
18+
19+
- Fixes subnet recreation when a subnet is updated. [#73]
20+
21+
22+
## [1.5.0] - 2019-11-06
23+
24+
### Added
25+
26+
- Added submodule `network-peering` [#101]
27+
28+
## [1.4.3] - 2019-10-31
29+
30+
### Fixed
31+
32+
- Fixed issue with depending on outputs introduced in 1.4.1. [#95]
33+
34+
## [1.4.2] - 2019-10-30
35+
36+
### Fixed
37+
38+
- The outputs `network_name`, `network_self_link`, and
39+
`subnets_secondary_ranges` depend on resource attributes rather than
40+
data source attributes when `create_network` = `true`. [#94]
41+
42+
## [1.4.1] - 2019-10-29
43+
44+
### Added
45+
46+
- Made network creation optional in root module. [#88]
47+
48+
### Fixed
49+
50+
- Fixed issue with depending on outputs introduced in 1.4.0. [#92]
51+
52+
## [1.4.0] - 2019-10-14
53+
54+
### Added
55+
56+
- Add dynamic firewall rules support to firewall submodule. [#79]
57+
58+
### Fixed
59+
60+
- Add `depends_on` to `created_subnets` data fetch (fixes issue [#80]). [#81]
61+
1062
## [1.3.0] - 2019-10-09
1163

1264
### Changed
@@ -112,7 +164,13 @@ and this project adheres to [Semantic Versioning][semver-site].
112164
- Subnets within the VPC
113165
- Secondary ranges for the subnets (if applicable)
114166

115-
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.3.0...HEAD
167+
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-network/compare/v2.0.0...HEAD
168+
[2.0.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.5.0...v2.0.0
169+
[1.5.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.3...v1.5.0
170+
[1.4.3]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.2...v1.4.3
171+
[1.4.2]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.1...v1.4.2
172+
[1.4.1]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.4.0...v1.4.1
173+
[1.4.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.3.0...v1.4.0
116174
[1.3.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.2.0...v1.3.0
117175
[1.2.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.1.0...v1.2.0
118176
[1.1.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v1.0.0...v1.1.0
@@ -126,6 +184,15 @@ and this project adheres to [Semantic Versioning][semver-site].
126184
[0.2.0]: https://github.com/terraform-google-modules/terraform-google-network/compare/v0.1.0...v0.2.0
127185
[0.1.0]: https://github.com/terraform-google-modules/terraform-google-network/releases/tag/v0.1.0
128186

187+
[#101]: https://github.com/terraform-google-modules/terraform-google-network/pull/101
188+
[#95]: https://github.com/terraform-google-modules/terraform-google-network/issues/95
189+
[#94]: https://github.com/terraform-google-modules/terraform-google-network/pull/94
190+
[#92]: https://github.com/terraform-google-modules/terraform-google-network/issues/92
191+
[#88]: https://github.com/terraform-google-modules/terraform-google-network/issues/88
192+
[#81]: https://github.com/terraform-google-modules/terraform-google-network/pull/81
193+
[#80]: https://github.com/terraform-google-modules/terraform-google-network/issues/80
194+
[#79]: https://github.com/terraform-google-modules/terraform-google-network/pull/79
195+
[#72]: https://github.com/terraform-google-modules/terraform-google-network/pull/72
129196
[#64]: https://github.com/terraform-google-modules/terraform-google-network/pull/64
130197
[#66]: https://github.com/terraform-google-modules/terraform-google-network/pull/66
131198
[#16]: https://github.com/terraform-google-modules/terraform-google-network/pull/16

CODEOWNERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
* @terraform-google-modules/cft-admins @andreyk-code
1+
* @terraform-google-modules/cft-admins @andreyk-code @jeanno
22

33
# CFT Fabric
44
/examples/submodule_svpc_access/ @terraform-google-modules/cft-fabric
55
/modules/fabric-net-svpc-access/ @terraform-google-modules/cft-fabric
66
/modules/fabric-net-firewall/ @terraform-google-modules/cft-fabric
77
/examples/submodule_firewall/ @terraform-google-modules/cft-fabric
8+
/modules/network-peering/ @terraform-google-modules/cft-fabric
9+
/examples/submodule_network_peering/ @terraform-google-modules/cft-fabric

CONTRIBUTING.md

Lines changed: 82 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,99 @@
1-
## File structure
2-
The project has the following folders and files:
1+
# Contributing
32

4-
- /: root folder
5-
- /examples: examples for using this module
6-
- /test: Folders with files for testing the module (see Testing section on this file)
7-
- /main.tf: main file for this module, contains all the resources to create
8-
- /variables.tf: all the variables for the module
9-
- /output.tf: the outputs of the module
10-
- /README.md: this file
3+
This document provides guidelines for contributing to the module.
114

12-
## Testing and documentation generation
5+
## Dependencies
136

14-
### Requirements
15-
- [docker](https://docker.com/)
7+
The following dependencies must be installed on the development system:
168

17-
### Integration testing
18-
##### Terraform integration tests
9+
- [Docker Engine][docker-engine]
10+
- [Google Cloud SDK][google-cloud-sdk]
11+
- [make]
1912

20-
The module's integration tests are designed to be run within a Docker
21-
container containing all the dependencies required for testing. The
22-
`docker_test_integration` make target wraps this behavior but requires the
23-
following configuration to execute properly:
13+
## Generating Documentation for Inputs and Outputs
2414

25-
- Configure a service account with the roles documented above and export the JSON key to the `SERVICE_ACCOUNT_JSON` environment variable
15+
The Inputs and Outputs tables in the READMEs of the root module,
16+
submodules, and example modules are automatically generated based on
17+
the `variables` and `outputs` of the respective modules. These tables
18+
must be refreshed if the module interfaces are changed.
2619

27-
export SERVICE_ACCOUNT_JSON=$(< /path/to/credentials.json)
20+
### Execution
2821

29-
- Create `test/fixtures/shared/terraform.tfvars` and populate with the required Terraform input variables (see `test/fixtures/shared/terraform.tfvars.sample` for more information)
22+
Run `make generate_docs` to generate new Inputs and Outputs tables.
3023

31-
Once those steps have been completed run `make docker_test_integration` from
32-
the root of the repository to execute the tests within the `project_id`
33-
provided. Infrastructure from `test/fixtures/*` will be provisioned,
34-
integration tests from `test/integration/*` will be executed, and the
35-
infrastructure will be deprovisioned to complete the process.
24+
## Integration Testing
3625

37-
### Autogeneration of documentation from .tf files
38-
Run
39-
```
40-
make generate_docs
41-
```
26+
Integration tests are used to verify the behaviour of the root module,
27+
submodules, and example modules. Additions, changes, and fixes should
28+
be accompanied with tests.
29+
30+
The integration tests are run using [Kitchen][kitchen],
31+
[Kitchen-Terraform][kitchen-terraform], and [InSpec][inspec]. These
32+
tools are packaged within a Docker image for convenience.
4233

43-
### Lint testing
34+
The general strategy for these tests is to verify the behaviour of the
35+
[example modules](./examples/), thus ensuring that the root module,
36+
submodules, and example modules are all functionally correct.
4437

45-
Lint testing is also performed within a Docker container containing all the
46-
dependencies required for lint tests. Execute those tests by running `make
47-
docker_test_lint` from the root of the repository.
38+
### Test Environment
39+
The easiest way to test the module is in an isolated test project. The setup for such a project is defined in [test/setup](./test/setup/) directory.
4840

49-
Successful output looks similar to the following:
41+
To use this setup, you need a service account with Project Creator access on a folder. Export the Service Account credentials to your environment like so:
42+
43+
```
44+
export SERVICE_ACCOUNT_JSON=$(< credentials.json)
45+
```
5046

47+
You will also need to set a few environment variables:
5148
```
52-
Checking for trailing whitespace
53-
Checking for missing newline at end of file
54-
Running shellcheck
55-
Checking file headers
56-
Running flake8
57-
Running terraform fmt
58-
terraform fmt -diff -check=true -write=false .
59-
terraform fmt -diff -check=true -write=false ./codelabs/simple
60-
terraform fmt -diff -check=true -write=false ./examples/delete_default_gateway_routes
61-
terraform fmt -diff -check=true -write=false ./examples/multi_vpc
62-
terraform fmt -diff -check=true -write=false ./examples/secondary_ranges
63-
terraform fmt -diff -check=true -write=false ./examples/simple_project
64-
terraform fmt -diff -check=true -write=false ./examples/simple_project_with_regional_network
65-
terraform fmt -diff -check=true -write=false ./examples/submodule_firewall
66-
terraform fmt -diff -check=true -write=false ./examples/submodule_svpc_access
67-
terraform fmt -diff -check=true -write=false ./modules/fabric-net-firewall
68-
terraform fmt -diff -check=true -write=false ./modules/fabric-net-svpc-access
69-
terraform fmt -diff -check=true -write=false ./test/fixtures/all_examples
70-
terraform fmt -diff -check=true -write=false ./test/fixtures/delete_default_gateway_routes
71-
terraform fmt -diff -check=true -write=false ./test/fixtures/multi_vpc
72-
terraform fmt -diff -check=true -write=false ./test/fixtures/secondary_ranges
73-
terraform fmt -diff -check=true -write=false ./test/fixtures/shared
74-
terraform fmt -diff -check=true -write=false ./test/fixtures/simple_project
75-
terraform fmt -diff -check=true -write=false ./test/fixtures/simple_project_with_regional_network
76-
terraform fmt -diff -check=true -write=false ./test/fixtures/simulated_ci_environment
77-
terraform fmt -diff -check=true -write=false ./test/fixtures/submodule_firewall
78-
Running terraform validate
79-
terraform_validate .
80-
Success! The configuration is valid.
81-
82-
terraform_validate ./codelabs/simple
83-
Success! The configuration is valid.
84-
85-
terraform_validate ./examples/delete_default_gateway_routes
86-
Success! The configuration is valid.
87-
88-
terraform_validate ./examples/multi_vpc
89-
Success! The configuration is valid.
90-
91-
terraform_validate ./examples/secondary_ranges
92-
Success! The configuration is valid.
93-
94-
terraform_validate ./examples/simple_project
95-
Success! The configuration is valid.
96-
97-
terraform_validate ./examples/simple_project_with_regional_network
98-
Success! The configuration is valid.
99-
100-
terraform_validate ./examples/submodule_firewall
101-
Success! The configuration is valid.
102-
103-
terraform_validate ./examples/submodule_svpc_access
104-
Success! The configuration is valid.
105-
106-
terraform_validate ./modules/fabric-net-firewall
107-
Success! The configuration is valid.
108-
109-
terraform_validate ./modules/fabric-net-svpc-access
110-
Success! The configuration is valid.
111-
112-
terraform_validate ./test/fixtures/all_examples
113-
Success! The configuration is valid.
114-
115-
terraform_validate ./test/fixtures/delete_default_gateway_routes
116-
Success! The configuration is valid.
117-
118-
terraform_validate ./test/fixtures/multi_vpc
119-
Success! The configuration is valid.
120-
121-
terraform_validate ./test/fixtures/secondary_ranges
122-
Success! The configuration is valid.
123-
124-
terraform_validate ./test/fixtures/simple_project
125-
Success! The configuration is valid.
126-
127-
terraform_validate ./test/fixtures/simple_project_with_regional_network
128-
Success! The configuration is valid.
129-
130-
terraform_validate ./test/fixtures/simulated_ci_environment
131-
Success! The configuration is valid.
132-
133-
terraform_validate ./test/fixtures/submodule_firewall
134-
Success! The configuration is valid.
49+
export TF_VAR_org_id="your_org_id"
50+
export TF_VAR_folder_id="your_folder_id"
51+
export TF_VAR_billing_account="your_billing_account_id"
13552
```
13653

137-
[terraform-provider-google]: https://github.com/terraform-providers/terraform-provider-google
54+
With these settings in place, you can prepare a test project using Docker:
55+
```
56+
make docker_test_prepare
57+
```
58+
59+
### Noninteractive Execution
60+
61+
Run `make docker_test_integration` to test all of the example modules
62+
noninteractively, using the prepared test project.
63+
64+
### Interactive Execution
65+
66+
1. Run `make docker_run` to start the testing Docker container in
67+
interactive mode.
68+
69+
1. Run `kitchen_do create <EXAMPLE_NAME>` to initialize the working
70+
directory for an example module.
71+
72+
1. Run `kitchen_do converge <EXAMPLE_NAME>` to apply the example module.
73+
74+
1. Run `kitchen_do verify <EXAMPLE_NAME>` to test the example module.
75+
76+
1. Run `kitchen_do destroy <EXAMPLE_NAME>` to destroy the example module
77+
state.
78+
79+
## Linting and Formatting
80+
81+
Many of the files in the repository can be linted or formatted to
82+
maintain a standard of quality.
83+
84+
### Execution
85+
86+
Run `make docker_test_lint`.
87+
88+
[docker-engine]: https://www.docker.com/products/docker-engine
89+
[flake8]: http://flake8.pycqa.org/en/latest/
90+
[gofmt]: https://golang.org/cmd/gofmt/
91+
[google-cloud-sdk]: https://cloud.google.com/sdk/install
92+
[hadolint]: https://github.com/hadolint/hadolint
93+
[inspec]: https://inspec.io/
94+
[kitchen-terraform]: https://github.com/newcontext-oss/kitchen-terraform
95+
[kitchen]: https://kitchen.ci/
96+
[make]: https://en.wikipedia.org/wiki/Make_(software)
97+
[shellcheck]: https://www.shellcheck.net/
98+
[terraform-docs]: https://github.com/segmentio/terraform-docs
99+
[terraform]: https://terraform.io/

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Make will use bash instead of sh
1616
SHELL := /usr/bin/env bash
1717

18-
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.1.0
18+
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.6.0
1919
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
2020
REGISTRY_URL := gcr.io/cloud-foundation-cicd
2121

@@ -42,7 +42,7 @@ docker_test_prepare:
4242

4343
# Clean up test environment within the docker container
4444
.PHONY: docker_test_cleanup
45-
docker_test_prepare:
45+
docker_test_cleanup:
4646
docker run --rm -it \
4747
-e SERVICE_ACCOUNT_JSON \
4848
-e TF_VAR_org_id \

0 commit comments

Comments
 (0)