π΅ Monthly estimates based on Infracost baseline costs.
Terraform example module for a Google Cloud Platform network.
Note
We do not recommend consuming this module like you might a public module. It is a baseline, something you can fork, potentially maintain, and modify to fit your organization's needs. Using public modules vs. writing your own has various drivers and trade-offs that your organization should evaluate.
Tip
You can check the tests/fixtures directory for example configurations. These fixtures set up the system for testing by providing all the necessary initial code, thus creating good examples on which to base your configurations.
Our focus is on the core fundamental practice of platform engineering, Infrastructure as Code.
Open Source Infrastructure (as Code) is a development model for infrastructure that focuses on open collaboration and applying relative lessons learned from software development practices that organizations can use internally at scale. - Open Source Infrastructure (as Code)
To avoid slowing down stream-aligned teams, we want to open up the possibility for contributions. The Open Source Infrastructure (as Code) model allows team members external to the platform team to contribute with only a slight increase in cognitive load. This section is for developers who want to contribute to this repository, describing the tools used, the skills, and the knowledge required, along with Terraform documentation.
See the documentation for setting up a local development environment here.
Links to documentation and other resources required to develop and iterate in this repository successfully.
All tests are mocked allowing us to test the module without creating infrastructure or requiring credentials. The trade-offs are acceptable in favor of speed and simplicity. In a Terraform test, a mocked provider or resource will generate fake data for all computed attributes that would normally be provided by the underlying provider APIs.
terraform init
terraform test
A child module automatically inherits default (un-aliased) provider configurations from its parent. The provider versions below are informational only and do not need to align with the provider configurations from its parent.
Name | Version |
---|---|
6.2.0 |
Name | Type |
---|---|
google_compute_firewall.rules | resource |
google_compute_network.this | resource |
google_compute_shared_vpc_host_project.this | resource |
google_compute_shared_vpc_service_project.this | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | Name of the network to create | string |
"osinfra-vpc" |
no |
project | The ID of the project in which the resource belongs | string |
n/a | yes |
rules | List of firewall rule definitions | list(object({ allow = optional(list(object({ ports = list(string) protocol = string })), []) deny = optional(list(object({ ports = list(string) protocol = string })), []) description = optional(string) direction = string log_config_enabled = optional(bool, true) log_config_metadata = optional(string, "INCLUDE_ALL_METADATA") name = string priority = optional(number) ranges = optional(list(string)) source_tags = optional(list(string)) target_tags = optional(list(string)) })) |
[] |
no |
shared_vpc | Enable VPC sharing | bool |
false |
no |
shared_vpc_service_projects | The set of service projects to attach to the shared VPC | set(string) |
[] |
no |
Name | Description |
---|---|
name | The network name |
self_link | The URI of the created resource |