Skip to content

Latest commit

 

History

History
115 lines (97 loc) · 6 KB

File metadata and controls

115 lines (97 loc) · 6 KB

Reserved IP's Module

The module creates reserved IPs (https://cloud.ibm.com/docs/vpc?topic=vpc-managing-ip-addresses) on existing subnets. Reserved IPs can be assigned to your resources, for example VPE endpoint gateways.

The module supports the following actions:

  • Create reserved IP addresses

Usage

provider "ibm" {
  ibmcloud_api_key = "XXXXXXXXXX" # pragma: allowlist secret
  region           = "us-south"
}

# - Reserved IP
module "ip" {
  source           = "terraform-ibm-modules/vpe-gateway/ibm//modules/reserved-ips"
  cloud_services = [
    {
      service_name = "kms"
    },
    {
      service_name = "cloud-object-storage"
    }
  ]
  subnet_zone_list = [
    [
      {
        "id" = "0717-6ff0a6fb-e180-4048-9daf-a2f99f8740cd"
        "name" = "vpe-vpc-instance-subnet-a"
        "zone" = "us-south-1"
      }
    ],
    [
      {
        "id" = "0727-c402f19e-ee68-41b6-90f0-a17d51f629ff"
        "name" = "vpe-vpc-instance-subnet-b"
        "zone" = "us-south-2"
      }
    ],
    [
      {
        "id" = "0737-323dc004-19c5-4d27-b5bc-028b1189a316"
        "name" = "vpe-vpc-instance-subnet-c"
        "zone" = "us-south-3"
      }
    ],
  ]
  region           = "us-south"
  prefix           = "vpe-default"
  vpc_name         = "vpc-instance"
}

The above will create 6 new reserved ips as such and output them:

  reserved_ips = {
    "vpe-vpc-cloud-object-storage-1" = "0717-13bea57a-61cd-4c91-bc17-77e0a1088283"
    "vpe-vpc-cloud-object-storage-2" = "0727-5d84bf9a-20ca-4592-9f8c-b8c2d0e7f5ac"
    "vpe-vpc-cloud-object-storage-3" = "0737-6a6a353d-16d0-4aaf-a46f-14f312363a62"
    "vpe-vpc-kms-1" = "0717-d00e85c2-4e6a-43ef-81a7-58f69ecc70af"
    "vpe-vpc-kms-2" = "0727-bd171da2-f4d6-4f12-906f-8157f16a03ad"
    "vpe-vpc-kms-3" = "0737-8e2485dd-9ca9-4818-bfc7-9a5861901de3"
  }

Required IAM access policies

You need the following permissions to run this module.

  • Account Management
    • Resource Group service
      • Viewer platform access
  • IAM Services
    • VPC Infrastructure Services service
      • Editor platform access

Requirements

Name Version
terraform >=1.3
ibm >= 1.58.0, <2.0.0

Modules

No modules.

Resources

Name Type
ibm_is_subnet_reserved_ip.ip resource

Inputs

Name Description Type Default Required
cloud_service_by_crn List of cloud service CRNs. Each CRN will have a unique endpoint gateways created. For a list of supported services, see the docs here.
list(
object({
name = string # service name
crn = string # service crn
})
)
[] no
endpoint_ip_list List of IPs to create. Each object contains an ip name and subnet id
list(
object({
ip_name = string # reserved ip name
subnet_id = string # subnet id
gateway_name = string # gateway name
name = string # ip name
})
)
[] no
prefix The prefix that you would like to append to your resources. Value is only used if no value is passed for the vpe_name option in the reserved_ip_cloud_services input variable. string "vpe" no
region The region to be used in the reserved ip naming convention. string "us-south" no
reserved_ip_cloud_services List of cloud services to create reserved ips for. The keys are the service names, the values (all optional) give some level of control on the created VPEs.
set(object({
service_name = string
vpe_name = optional(string),
}))
[] no
reserved_ips Map of existing reserved IP names and values. Leave this value as default if you want to create new reserved ips, this value is used in the main module in which a user passes their existing reserved ips created here so as to not attempt to recreate them.
object({
name = optional(string) # reserved ip name
})
{} no
subnet_zone_list List of subnets in the VPC where reserved IPs will be provisioned. name, and zone are used in the naming convention of the reserved ip's which are then assigned to the subnet id. This value is intended to use the subnet_zone_list output from the Landing Zone VPC Subnet Module (https://github.com/terraform-ibm-modules/terraform-ibm-landing-zone-vpc) or from templates using that module for subnet creation.
list(
object({
name = string
id = string
zone = optional(string)
})
)
[] no
vpc_name Name of the VPC that will be used in naming the newly created reserved ip(s). Value is only used if no value is passed for the vpe_name option in the reserved_ip_cloud_services input variable. string "vpc" no

Outputs

Name Description
endpoint_ip_list The endpoint gateway reserved ips
reserved_ip_map The endpoint gateway reserved ips