An open API service indexing awesome lists of open source software.

https://github.com/terraform-ibm-modules/terraform-ibm-vpc

Provisions and configures IBM Cloud VPC resources
https://github.com/terraform-ibm-modules/terraform-ibm-vpc

core-team ibm-cloud terraform terraform-module vpc

Last synced: 2 days ago
JSON representation

Provisions and configures IBM Cloud VPC resources

Awesome Lists containing this project

README

          

# IBM Cloud VPC module

[![Stable (With quality checks)](https://img.shields.io/badge/Status-Stable%20(With%20quality%20checks)-green)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-vpc?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-vpc/releases/latest)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

## Terraform Module for IBM Cloud VPC Infrastructure

This module provides a comprehensive solution for managing IBM Cloud Virtual Private Cloud (VPC) infrastructure. It includes a main module and several submodules, enabling you to create, configure, and manage VPC components either individually or through the main module.

This module is designed to provide a scalable, secure, and flexible VPC environment tailored to meet various use cases within IBM Cloud, supporting a broad range of infrastructure needs from basic networking setups to complex multi-zone architectures.

## Overview
* [terraform-ibm-vpc](#terraform-ibm-vpc)
* [Submodules](./modules)
* [floatingIP](./modules/floatingIP)
* [image](./modules/image)
* [instance](./modules/instance)
* [load-balancer](./modules/load-balancer)
* [network-acl](./modules/network-acl)
* [public-gateway](./modules/public-gateway)
* [security-group](./modules/security-group)
* [ssh-key](./modules/ssh-key)
* [subnet](./modules/subnet)
* [volume](./modules/volume)
* [vpc-address-prefix](./modules/vpc-address-prefix)
* [vpc](./modules/vpc)
* [vpe](./modules/vpe)
* [vpn-gateway-connection](./modules/vpn-gateway-connection)
* [vpn-gateway](./modules/vpn-gateway)
* [Examples](./examples)
* [Basic example](./examples/basic)
* [Contributing](#contributing)

## terraform-ibm-vpc

### Usage

```hcl
module "vpc" {
source = "terraform-ibm-modules/vpc/ibm"
version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release

vpc_name = "stage-vpc"
resource_group_id = module.resource_group.resource_group_id
locations = ["us-south-1", "us-south-2", "us-south-3"]
vpc_tags = var.resource_tags
address_prefixes = [
{
name = "stage-us-south-1"
location = "us-south-1"
ip_range = "10.10.10.0/24"
},
{
name = "stage-us-south-2"
location = "us-south-2"
ip_range = "10.10.20.0/24"
},
{
name = "stage-us-south-3"
location = "us-south-3"
ip_range = "10.10.30.0/24"
}
]

subnet_name_prefix = "stage-subnet"
default_network_acl_name = "stage-nacl"
default_routing_table_name = "stage-routing-table"
default_security_group_name = "stage-sg"
create_gateway = true
public_gateway_name_prefix = "stage-pw"
number_of_addresses = 16
}
```

### Required IAM access policies
You need the following permissions to run this module.

- IAM services
- **VPC Infrastructure** services
- `Editor` platform access
- **No service access**
- **Resource Group** \
- `Viewer` resource group access

### Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.9.0 |
| [ibm](#requirement\_ibm) | >= 1.64.0, <2.0.0 |

### Modules

| Name | Source | Version |
|------|--------|---------|
| [vpc](#module\_vpc) | ./modules/vpc | n/a |

### Resources

No resources.

### Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [address\_prefixes](#input\_address\_prefixes) | List of Prefixes for the vpc |

list(object({
name = string
location = string
ip_range = string
}))
| `[]` | no |
| [auto\_assign\_address\_prefix](#input\_auto\_assign\_address\_prefix) | Set to true to create a default address prefix automatically for each zone in the VPC. | `bool` | `true` | no |
| [clean\_default\_sg\_acl](#input\_clean\_default\_sg\_acl) | Remove all rules from the default VPC security group and VPC ACL (less permissive) | `bool` | `false` | no |
| [create\_gateway](#input\_create\_gateway) | True to create new Gateway | `bool` | `false` | no |
| [create\_vpc](#input\_create\_vpc) | True to create new VPC. False if VPC is already existing and subnets or address prefixies are to be added | `bool` | `true` | no |
| [default\_network\_acl\_name](#input\_default\_network\_acl\_name) | Name of the Default ACL | `string` | `"default-network-acl"` | no |
| [default\_routing\_table\_name](#input\_default\_routing\_table\_name) | Name of the Default Routing Table | `string` | `"default_routing_table"` | no |
| [default\_security\_group\_name](#input\_default\_security\_group\_name) | Name of the Default Security Group | `string` | `"default_security_group"` | no |
| [existing\_vpc\_name](#input\_existing\_vpc\_name) | Name of the Existing VPC to which subnets, gateways are to be attached, only used when `var.create_vpc` is false | `string` | `null` | no |
| [floating\_ip](#input\_floating\_ip) | Floating IP `id`'s or `address`'es that you want to assign to the public gateway | `map(any)` | `{}` | no |
| [gateway\_tags](#input\_gateway\_tags) | List of Tags for the gateway | `list(string)` | `[]` | no |
| [locations](#input\_locations) | zones per region | `list(string)` | `[]` | no |
| [number\_of\_addresses](#input\_number\_of\_addresses) | Number of IPV4 Addresses | `number` | `null` | no |
| [public\_gateway\_name\_prefix](#input\_public\_gateway\_name\_prefix) | Prefix to the names of the Public Gateways | `string` | `"public_gateway"` | no |
| [resource\_group\_id](#input\_resource\_group\_id) | ID of resource group. | `string` | `null` | no |
| [subnet\_name\_prefix](#input\_subnet\_name\_prefix) | Prefix to the names of subnets | `string` | `"subnet"` | no |
| [vpc\_name](#input\_vpc\_name) | Name of the vpc | `string` | `null` | no |
| [vpc\_tags](#input\_vpc\_tags) | List of Tags for the vpc | `list(string)` | `[]` | no |

### Outputs

| Name | Description |
|------|-------------|
| [subnets](#output\_subnets) | List of subnets associated with the VPC |
| [vpc](#output\_vpc) | Configuration of newly created or existing VPC instance. |

## Contributing

You can report issues and request features for this module in GitHub issues in the module repo. See [Report an issue or request a feature](https://github.com/terraform-ibm-modules/.github/blob/main/.github/SUPPORT.md).

To set up your local development environment, see [Local development setup](https://terraform-ibm-modules.github.io/documentation/#/local-dev-setup) in the project documentation.