Skip to content

cloud-design-dev/IBM-Cloud-VPC-Subnet-CIDR-Module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IBM Cloud VPC Subnet CIDR Module

Terraform module for creating a VPC Subnet using a specific CIDR notation.

Usage

Subnet without a public gateway attached

data "ibm_resource_group" "group" {
  name = var.resource_group
}

data "ibm_is_zones" "mzr" {
  region = var.region
}

module subnet {
  source         = "git::https://github.com/cloud-design-dev/IBM-Cloud-VPC-Subnet-CIDR-Module.git"
  name           = var.name
  resource_group = data.ibm_resource_group.group.id
  network_acl    = var.network_acl
  address_count  = var.address_count
  vpc_id         = var.vpc_id
  zone           = data.ibm_is_zones.mzr.zones[0]
}

Subnet with a public gateway attached

data "ibm_resource_group" "group" {
  name = var.resource_group
}

data "ibm_is_zones" "mzr" {
  region = var.region
}

module subnet {
  source         = "git::https://github.com/cloud-design-dev/IBM-Cloud-VPC-Subnet-CIDR-Module.git"
  name           = var.name
  resource_group = data.ibm_resource_group.group.id
  network_acl    = var.network_acl
  address_count  = var.address_count
  vpc_id         = var.vpc_id
  zone           = data.ibm_is_zones.mzr.zones[0]
  public_gateway = var.public_gateway
}

Inputs

Name Description Type Default Required
resource_group_id ID of the resource group to associate with the virtual server instance string n/a yes
vpc_id ID of the VPC where to create the virtual server instance string n/a yes
subnet_cidr The CIDR for the subnet being created. string n/a yes
name Name of the virtual server instance string n/a yes
zone VPC zone where the virtual server instance will be created. string n/a yes
network_acl Network ACL to attach to subnet string "" no
public_gateway Public Gateway to attach to the subnet string "" no

Outputs

Name Description
id ID of the created Subnet
ipv4_cidr_block IPv4 CIDR block for the subnet
available_ipv4_address_count Number of IPs in the subnet

Releases

No releases published

Packages

No packages published

Languages