Code Monkey home page Code Monkey logo

terraform-google-network-subnet1's Introduction

Module - terraform-google-network-subnet

Terraform module which creates a google cloud subnetwork with options for secondary CIDR ranges.

Assumptions

  • You want to create a set of subnetworks around an GCP Network.
  • You've already created a bunch of subnetworks with distinct configurations (with and without secondary ranges) and want to centralize it in only one module

Usage

With Secondary CIDR Range

module "aliased-subnetwork" {
  source = "./modules/subnetwork"

  name          = "aliased-subnet"
  network       = "${google_compute_network.network.self_link}"
  ip_cidr_range = "10.100.0.0/24"

  create_secondary_ranges = true
  secondary_ranges        = [
    {
      range_name    = "range-1"
      ip_cidr_range = "10.101.0.0/24"
    },
    {
      range_name    = "range-2"
      ip_cidr_range = "10.102.0.0/24"
    },
  ]
}

Without Secondary CIDR Range

module "basic-subnetwork" {
  source = "./modules/subnetwork"

  name          = "basic-subnet"
  description   = "Basic subnet"
  network       = "${google_compute_network.network.self_link}"
  ip_cidr_range = "10.100.0.0/24"

}

Then perform the following commands on the root folder:

  • terraform init to get the plugins
  • terraform plan to see the infrastructure plan
  • terraform apply to apply the infrastructure build
  • terraform destroy to destroy the built infrastructure

Inputs

Name Description Type Default Required
name Name of subnet. string - yes
description Description usage of subnet string name subnetwork no
network Name of selflink to the VPC this subnet will be linked to. Defaults to 'default' network string - yes
ip_cidr_range IP range in CIDR format of the subnet string - yes
region Region in which subnet will be created string provider region no
create_secondary_ranges Enable secondary ip ranges to be used with secondary_ranges variable string false no
secondary_ranges Create up to 5 alternative CIDR range to represent this subnetwork list none no

Outputs

Name Description
name Subnetwork name
gateway_address The IP address of the gateway.
ip_cidr_range The IP address range that machines in this network are assigned to, represented as a CIDR block
secondary_range_names List of names for the secondary ranges created.
secondary_range_cidrs List of CIDR blocks for the secondary ranges created.

Reference

License

MIT Licensed. See LICENSE for full details.

terraform-google-network-subnet1's People

Contributors

sabornid avatar riflerrick avatar lantier avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.