cgascoig / terraform-intersight-pools-ip

Terraform - Intersight > Pools > IP Module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests

Terraform Intersight Pools - IP

Manages Intersight IP Pools

Location in GUI: Pools » Create Pool » IP

Example

main.tf

module "ip_pool" {
  source  = "terraform-cisco-modules/pools-ip/intersight"
  version = ">= 1.0.2"

  assignment_order = "sequential"
  description      = "default IP Pool"
  ipv4_blocks = [
    {
      from = "198.18.0.10"
      size = 240
    }
  ]
  ipv4_config = [
    {
      gateway       = "198.18.0.1"
      netmask       = "255.255.255.0"
      primary_dns   = "208.67.220.220"
      secondary_dns = "208.67.222.222"
    }
  ]
  ipv6_blocks = [
    {
      from = "2001:db8::10"
      size = 1000
    }
  ]
  ipv6_config = [
    {
      gateway       = "2001:db8::1"
      prefix        = 64
      primary_dns   = "2620:119:53::53"
      secondary_dns = "2620:119:35::35"
    }
  ]
  name         = "default"
  organization = "default"
}

provider.tf

terraform {
  required_providers {
    intersight = {
      source  = "CiscoDevNet/intersight"
      version = ">=1.0.32"
    }
  }
  required_version = ">=1.3.0"
}

provider "intersight" {
  apikey    = var.apikey
  endpoint  = var.endpoint
  secretkey = var.secretkey
}

variables.tf

variable "apikey" {
  description = "Intersight API Key."
  sensitive   = true
  type        = string
}

variable "endpoint" {
  default     = "https://intersight.com"
  description = "Intersight URL."
  type        = string
}

variable "secretkey" {
  description = "Intersight Secret Key."
  sensitive   = true
  type        = string
}

Environment Variables

Terraform Cloud/Enterprise - Workspace Variables

  • Add variable apikey with value of [your-api-key]
  • Add variable secretkey with value of [your-secret-file-content]

Linux

export TF_VAR_apikey="<your-api-key>"
export TF_VAR_secretkey=`cat <secret-key-file-location>`

Windows

$env:TF_VAR_apikey="<your-api-key>"
$env:TF_VAR_secretkey="<secret-key-file-location>""

Requirements

Name Version
terraform >=1.3.0
intersight >=1.0.32

Providers

Name Version
intersight 1.0.32

Inputs

Name Description Type Default Required
apikey Intersight API Key. string n/a yes
endpoint Intersight URL. string "https://intersight.com" no
secretkey Intersight Secret Key. string n/a yes
assignment_order Assignment order decides the order in which the next identifier is allocated.
* sequential - Identifiers are assigned in a sequential order.
* default - Assignment order is decided by the system.
string "default" no
description Description for the IP Pool. string "" no
ipv4_blocks List of IPv4 Address Parameters to Assign to the IP Pool.
* from - Starting IPv4 Address. Example "198.18.0.10".
* size - Size of the IPv4 Address Pool. Example "240".
* to - Ending IPv4 Address. Example "198.18.0.250"
* IMPORTANT NOTE: You can only Specify size or to on initial creation. This is a limitation of the API.
list(object(
{
from = string
size = optional(number, null)
to = optional(string, null)
}
))
[] no
ipv4_config List of IPv4 Addresses to Assign to the IP Pool.
* gateway - Gateway of the Subnet. Example "198.18.0.1".
* netmask - Netmask of the Subnet in X.X.X.X format. Example "255.255.255.0".
* primary_dns = Primary DNS Server to Assign to the Pool. Example "208.67.220.220".
* secondary_dns = Secondary DNS Server to Assign to the Pool. Example "208.67.222.222".
list(object(
{
gateway = string
netmask = string
primary_dns = optional(string, "208.67.220.220")
secondary_dns = optional(string, "")
}
))
[] no
ipv6_blocks List of IPv6 Addresses to Assign to the IP Pool.
* from - Starting IPv6 Address. Example "2001:db8::10".
* size - Size of the IPv6 Address Pool. Example "1000".
* to - Ending IPv6 Address. Example "2001:db8::3f2".
* IMPORTANT NOTE: You can only Specify size or to on initial creation. This is a limitation of the API.
list(object(
{
from = string
size = optional(number, null)
to = optional(string, null)
}
))
[] no
ipv6_config List of IPv6 Configuration Parameters to Assign to the IP Pool.
* gateway - Gateway of the Subnet. Example "2001:db8::1".
* prefix - Prefix of the Subnet in Integer format. Example "64".
* primary_dns = Primary DNS Server to Assign to the Pool. Example "2620:119:35::35".
* secondary_dns = Secondary DNS Server to Assign to the Pool. Example "2620:119:53::53".
list(object(
{
gateway = string
prefix = number
primary_dns = optional(string, "2620:119:53::53")
secondary_dns = optional(string, "::")
}
))
[] no
name Name for the IP Pool. string "default" no
organization Intersight Organization Name to Apply Policy to. https://intersight.com/an/settings/organizations/. string "default" no
tags List of Tag Attributes to Assign to the Policy. list(map(string)) [] no

Outputs

Name Description
moid IP Pool Managed Object ID (moid).

Resources

Name Type
intersight_ippool_pool.ip resource
intersight_organization_organization.org_moid data source

About

Terraform - Intersight > Pools > IP Module

License:Apache License 2.0


Languages

Language:HCL 67.4%Language:Go 32.6%