From 1245a997becdd4471bf1f96324c5110bd33d5dfa Mon Sep 17 00:00:00 2001 From: badra001 Date: Wed, 12 Oct 2022 11:28:03 -0400 Subject: [PATCH] add examples for ipam, shared vpc --- examples/shared-vpc-setup/region.tf | 4 +++ examples/shared-vpc-setup/tags.tf | 12 +++++++ examples/shared-vpc-setup/tf-run.data | 8 +++++ examples/vpc-ipam-infoblox/infoblox.tf | 33 +++++++++++++++++++ .../vpc-ipam-infoblox/tf-run.data.snippet | 3 ++ examples/vpc-ipam-infoblox/versions.tf | 12 +++++++ 6 files changed, 72 insertions(+) create mode 100644 examples/shared-vpc-setup/region.tf create mode 100644 examples/shared-vpc-setup/tags.tf create mode 100644 examples/shared-vpc-setup/tf-run.data create mode 100644 examples/vpc-ipam-infoblox/infoblox.tf create mode 100644 examples/vpc-ipam-infoblox/tf-run.data.snippet create mode 100644 examples/vpc-ipam-infoblox/versions.tf diff --git a/examples/shared-vpc-setup/region.tf b/examples/shared-vpc-setup/region.tf new file mode 100644 index 0000000..b7b1696 --- /dev/null +++ b/examples/shared-vpc-setup/region.tf @@ -0,0 +1,4 @@ +locals { + region = var.region +} + diff --git a/examples/shared-vpc-setup/tags.tf b/examples/shared-vpc-setup/tags.tf new file mode 100644 index 0000000..22ad78a --- /dev/null +++ b/examples/shared-vpc-setup/tags.tf @@ -0,0 +1,12 @@ +module "tag_shared" { + source = "git@github.e.it.census.gov:terraform-modules/aws-vpc-setup.git//tag-shared-vpc-resources?ref=tf-upgrade" + network_account_profile = "057445207498-ent-gov-network-sa" + + ## optional, with defaults + ### tag_enabled_vpcs = true + ### tag_enabled_dhcp_options = true + ### tag_enabled_route_tables = true + ### tag_enabled_subnets = true + ### tag_enabled_network_acls = true + ### tag_enabled_transit_gateway = false +} diff --git a/examples/shared-vpc-setup/tf-run.data b/examples/shared-vpc-setup/tf-run.data new file mode 100644 index 0000000..fb40c84 --- /dev/null +++ b/examples/shared-vpc-setup/tf-run.data @@ -0,0 +1,8 @@ +VERSION 1.0.1 +REMOTE-STATE +COMMAND tf-directory-setup.py -l none -f +COMMAND setup-new-directory.sh +COMMAND tf-init -upgrade +ALL +ALL +COMMAND tf-directory-setup.py -l s3 diff --git a/examples/vpc-ipam-infoblox/infoblox.tf b/examples/vpc-ipam-infoblox/infoblox.tf new file mode 100644 index 0000000..4e1b484 --- /dev/null +++ b/examples/vpc-ipam-infoblox/infoblox.tf @@ -0,0 +1,33 @@ +resource "infoblox_ipv4_network_container" "vpc" { + network_view = "default" + cidr = var.vpc_cidr_block + comment = format("%v %v %v %v", "AWS", var.account_alias, local.region, var.vpc_full_name) +} + +resource "infoblox_ipv4_network_container" "vpc_public" { + for_each = { for sn in var.public_subnets : sn.label => sn } + network_view = "default" + cidr = each.value.base_cidr + comment = format("%v %v %v %v %v", "AWS", var.account_alias, local.region, var.vpc_full_name, each.value.label) +} + +resource "infoblox_ipv4_network_container" "vpc_private" { + for_each = { for sn in var.private_subnets : sn.label => sn } + network_view = "default" + cidr = each.value.base_cidr + comment = format("%v %v %v %v %v", "AWS", var.account_alias, local.region, var.vpc_full_name, each.value.label) +} + +resource "infoblox_ipv4_network" "vpc_public_subnets" { + for_each = { for sn in module.subnets.public_subnets_ids : sn.subnet => sn } + network_view = "default" + cidr = each.value.subnet + comment = format("%v %v %v %v %v", "AWS", var.account_alias, local.region, var.vpc_full_name, each.value.label) +} + +resource "infoblox_ipv4_network" "vpc_private_subnets" { + for_each = { for sn in module.subnets.private_subnets_ids : sn.subnet => sn } + network_view = "default" + cidr = each.value.subnet + comment = format("%v %v %v %v %v", "AWS", var.account_alias, local.region, var.vpc_full_name, each.value.label) +} diff --git a/examples/vpc-ipam-infoblox/tf-run.data.snippet b/examples/vpc-ipam-infoblox/tf-run.data.snippet new file mode 100644 index 0000000..24e3043 --- /dev/null +++ b/examples/vpc-ipam-infoblox/tf-run.data.snippet @@ -0,0 +1,3 @@ +LINKTOP provider_configs.d/provider.infoblox.auto.tfvars +LINKTOP provider_configs.d/provider.infoblox.tf +LINKTOP provider_configs.d/provider.infoblox.variables.tf diff --git a/examples/vpc-ipam-infoblox/versions.tf b/examples/vpc-ipam-infoblox/versions.tf new file mode 100644 index 0000000..e52cfe4 --- /dev/null +++ b/examples/vpc-ipam-infoblox/versions.tf @@ -0,0 +1,12 @@ +#terraform { +# experiments = [module_variable_optional_attrs] +#} + +terraform { + required_providers { + infoblox = { + source = "infobloxopen/infoblox" + version = ">= 2.1.0" + } + } +}