/terraform-ibm-vpc-network

Terraform Module Repository which creates IBM VPC Network infrastructure

Primary LanguageHCLApache License 2.0Apache-2.0

IBM Cloud terraform-ibm-vpc-network - Terraform Module

Terraform Module Repository which creates IBM VPC Network infrastructure

This module a collection of modules that make it easier to provision VPC Network resources.

Compatibility

This module is meant for use with Terraform 0.13 (and higher).

Requirements

Terraform plugins

Install

Terraform

Be sure you have the correct Terraform version (0.13), you can choose the binary here:

Terraform plugins

Be sure you have the compiled plugins on $HOME/.terraform.d/plugins/

Pre-commit hooks

Run the following command to execute the pre-commit hooks defined in .pre-commit-config.yaml file

pre-commit run -a

You can install pre-coomit tool using

pip install pre-commit

or

pip3 install pre-commit

How to input variable values through a file

To review the plan for the configuration defined (no resources actually provisioned)

terraform plan -var-file=./input.tfvars

To execute and start building the configuration defined in the plan (provisions resources)

terraform apply -var-file=./input.tfvars

To destroy the VPC and all related resources

terraform destroy -var-file=./input.tfvars

Note

All optional parameters, by default, will be set to null in respective example's variable.tf file. You can also override these optional parameters.

Inputs

Name Description Type Default Required
create_vpc True to create new VPC. False if VPC is already existing and subnets, gateways are to be added to it bool n/a yes
vpc_name Name of the vpc. Required only if Creating a new VPC string n/a yes
region Region in which resources are to be created string "us-south" no
resource_group Name of the resource group string n/a no
classic_access Indicates whether this VPC should be connected to Classic Infrastructure. bool false no
default_address_prefix Indicates whether a default address prefix should be automatically created for each zone in this VPC. string auto no
default_network_acl_name Name of the Default ACL of the VPC string n/a no
default_security_group_name Name of the Default Security Group of the VPC string n/a no
default_routing_table_name Name of the Default Routing Table of the VPC string n/a no
vpc_tags List of tags to attach to the VPC list(string) n/a no
routing_table_list List of Routing tables list(object) n/a no
enable_gateway True to create new Public Gateways bool false no
floating_ip Floating IP id or address that you want to assign to the public gateway map n/a no
gateway_tags List of Tags for the gateway list(string) n/a no
unique_subnet_prefix Name(or Prefix) of the Subnet(s). Required only while Creating a new subnet(s) string n/a no
cidr_blocks CIDR blocks for subnets to be created and whether or not they are default to the subnet's zone. If no CIDR blocks are provided, it will create subnets with 256 total ipv4 addresses list(string) ["10.10.10.0/24,false", "10.10.11.0/24,", "10.10.12.0/24,"] no
subnets_per_zone Number of subnets per zone number 1 no
number_of_zones Number of zones to deploy subnets in number 3 no
total_ipv4_address_count Number of IPV4 Addresses. Required only while Creating a new subnet(s) number 256 no
ip_version IP Version of the subnets string n/a no
subnet_tags A list of tags to be applied to subnets list(string) n/a no
access_tags A list of access management tags of subnets list(string) n/a no
enable\acl True to create new ACL bool false no
acl_name Name of the Network ACL string n/a yes
acl_rules List of Network ACL Rules that are to be attached to the ACL list(object) n/a no
acl_tags List of tags to attach to ACL list(string) n/a no

Outputs

Name Description
vpc_id The ID of the VPC
vpc_default_security_group The ID of the vpc default security group
vpc_default_network_acl The ID of the vpc default network acl
vpc_default_routing_table The ID of the vpc default Routing Table
vpc_address_prefixes The ID(s) of the Address Prefixes to VPC
vpc_address_prefixes_cidr The Address Prefix CIDRs of the VPC
subnet_ids The ID(s) of the Subnet(s)
subnet_ipv4_cidrs IPV4 subnet CIDR blocks
public_gateway_ids The ID(s) of the Public Gateway(s)
network_acl_id The ID of the Network ACL