Skip to content

opsstation/terraform-gcp-vpc

Repository files navigation

Terraform-gcp-vpc

Terraform Google Cloud VPC Module

Table of Contents

Introduction

This Terraform module creates structured vpc for GCP resources with specific attributes.

Usage

  • Use the module by referencing its source and providing the required variables.

Example: vpc

module "vpc" {
  source                                    = "git::https://github.com/opsstation/terraform-gcp-vpc.git"
  name                                      = "dev"
  environment                               = "test"
  label_order                               = ["name", "environment"]
  mtu                                       = 1460
  routing_mode                              = "REGIONAL"
  google_compute_network_enabled            = true
  network_firewall_policy_enforcement_order = "AFTER_CLASSIC_FIREWALL"
  delete_default_routes_on_create           = false
}

Please ensure you specify the correct 'source' path for the module.

Module Inputs

  • name: The name of the application or resource.
  • environment: The environment in which the resource exists.
  • label_order: The order in which labels should be applied.
  • business_unit: The business unit associated with the application.
  • attributes: Additional attributes to add to the labels.
  • extra_tags: Extra tags to associate with the resource.

Module Outputs

  • This module currently does not provide any outputs.

Examples

For detailed examples on how to use this module, please refer to the example directory within this repository.

Authors

Your Name Replace '[License Name]' and '[Your Name]' with the appropriate license and your information. Feel free to expand this README with additional details or usage instructions as needed for your specific use case.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Requirements

Name Version
terraform >= 1.6.6
google >= 3.50, < 5.11.0

Providers

Name Version
google >= 3.50, < 5.11.0

Modules

Name Source Version
labels git::[email protected]:opsstation/terraform-gcp-labels.git v1.0.0

Resources

Name Type
google_compute_network.vpc_network resource
google_client_config.current data source

Inputs

Name Description Type Default Required
auto_create_subnetworks (Optional) When set to true, the network is created in [auto_subnet_mode] and it will create a subnet for each region automatically across the 10.128.0.0/9 address range. bool false no
delete_default_routes_on_create (Optional) If set to true, ensure that all routes within the network specified whose names begin with 'default-route' and with a next hop of 'default-internet-gateway' are deleted. bool false no
description (Optional) An optional description of the VPC. The resource must be recreated to modify this field.Default is ''. string "" no
enable_ula_internal_ipv6 (Optional) Enable ULA internal ipv6 on this network. Enabling this feature will assign a /48 from google defined ULA prefix fd20::/20. bool null no
enabled Set to false to prevent the module from creating any resources. bool true no
environment Environment (e.g. prod, dev, staging). string "" no
google_compute_network_enabled A boolean flag to enable/disable vpc. bool true no
internal_ipv6_range (Optional) When enabling ula internal ipv6, caller optionally can specify the /48 range they want from the google defined ULA prefix fd20::/20. The input must be a valid /48 ULA IPv6 address and must be within the fd20::/20. Operation will fail if the speficied /48 is already in used by another resource. If the field is not speficied, then a /48 range will be randomly allocated from fd20::/20 and returned via this field. bool null no
label_order Label order, e.g. sequence of application name and environment name,environment,'attribute' [webserver,qa,devops,public,] . list(any) [] no
managedby ManagedBy,opsstation'. string "opsstation'." no
mtu (Optional) Maximum Transmission Unit in bytes. The minimum value for this field is 1460 and the maximum value is 1500 bytes. Default is '1460'. number 1460 no
name Name (e.g. app or cluster). string "" no
network_firewall_policy_enforcement_order (Optional) Set the order that Firewall Rules and Firewall Policies are evaluated. Default value is AFTER_CLASSIC_FIREWALL. Possible values are: BEFORE_CLASSIC_FIREWALL, AFTER_CLASSIC_FIREWALL string "AFTER_CLASSIC_FIREWALL" no
repository Terraform current module repo string "" no
routing_mode - (Optional) The network-wide routing mode to use. If set to REGIONAL, this network's cloud routers will only advertise routes with subnetworks of this network in the same region as the router. string "REGIONAL" no

Outputs

Name Description
gateway_ipv4 The IPv4 address of the gateway
self_link The URI of the created resource
vpc_id The outputs of the created VPC.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages