fix: add more random names (#70)
Signed-off-by: matttrach <matt.trachier@suse.com>
This commit is contained in:
parent
261177ad4c
commit
403f6309ef
|
|
@ -12,17 +12,25 @@ provider "acme" {
|
||||||
}
|
}
|
||||||
locals {
|
locals {
|
||||||
identifier = var.identifier
|
identifier = var.identifier
|
||||||
name = "tf-${local.identifier}"
|
example = "basic"
|
||||||
|
project_name = "tf-${substr(md5(join("-", [local.example, random_pet.string.id])), 0, 5)}-${local.identifier}"
|
||||||
zone = var.zone
|
zone = var.zone
|
||||||
domain = "${local.identifier}.${local.zone}"
|
domain = "${local.identifier}.${local.zone}"
|
||||||
}
|
}
|
||||||
|
resource "random_pet" "string" {
|
||||||
|
keepers = {
|
||||||
|
# regenerate the pet name when the identifier changes
|
||||||
|
identifier = local.identifier
|
||||||
|
}
|
||||||
|
length = 1
|
||||||
|
}
|
||||||
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
||||||
module "this" {
|
module "this" {
|
||||||
source = "../../"
|
source = "../../"
|
||||||
vpc_name = local.name
|
vpc_name = "${local.project_name}-vpc"
|
||||||
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
||||||
security_group_name = local.name
|
security_group_name = "${local.project_name}-sg"
|
||||||
security_group_type = "egress"
|
security_group_type = "egress"
|
||||||
load_balancer_name = local.name
|
load_balancer_name = "${local.project_name}-lb"
|
||||||
domain = local.domain
|
domain = local.domain
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ terraform {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = ">= 5.11"
|
version = ">= 5.11"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = ">= 3.1"
|
||||||
|
}
|
||||||
acme = {
|
acme = {
|
||||||
source = "vancluever/acme"
|
source = "vancluever/acme"
|
||||||
version = ">= 2.0"
|
version = ">= 2.0"
|
||||||
|
|
|
||||||
|
|
@ -12,20 +12,28 @@ provider "acme" {
|
||||||
}
|
}
|
||||||
locals {
|
locals {
|
||||||
identifier = var.identifier
|
identifier = var.identifier
|
||||||
name = "tf-${local.identifier}"
|
example = "domain"
|
||||||
|
project_name = "tf-${substr(md5(join("-", [local.example, random_pet.string.id])), 0, 5)}-${local.identifier}"
|
||||||
owner = "terraform-ci@suse.com"
|
owner = "terraform-ci@suse.com"
|
||||||
zone = var.zone
|
zone = var.zone
|
||||||
domain = "${local.identifier}.${local.zone}"
|
domain = "${local.identifier}.${local.zone}"
|
||||||
#zone = var.domain_zone
|
#zone = var.domain_zone
|
||||||
}
|
}
|
||||||
|
resource "random_pet" "string" {
|
||||||
|
keepers = {
|
||||||
|
# regenerate the pet name when the identifier changes
|
||||||
|
identifier = local.identifier
|
||||||
|
}
|
||||||
|
length = 1
|
||||||
|
}
|
||||||
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
||||||
module "this" {
|
module "this" {
|
||||||
source = "../../"
|
source = "../../"
|
||||||
vpc_name = local.name
|
vpc_name = "${local.project_name}-vpc"
|
||||||
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
||||||
security_group_name = local.name
|
security_group_name = "${local.project_name}-sg"
|
||||||
security_group_type = "project"
|
security_group_type = "project"
|
||||||
load_balancer_name = local.name
|
load_balancer_name = "${local.project_name}-lb"
|
||||||
domain = local.domain
|
domain = local.domain
|
||||||
#domain_zone = local.zone # only specify when creating a new zone
|
#domain_zone = local.zone # only specify when creating a new zone
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ terraform {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = ">= 5.11"
|
version = ">= 5.11"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = ">= 3.1"
|
||||||
|
}
|
||||||
acme = {
|
acme = {
|
||||||
source = "vancluever/acme"
|
source = "vancluever/acme"
|
||||||
version = ">= 2.0"
|
version = ">= 2.0"
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,27 @@ provider "acme" {
|
||||||
}
|
}
|
||||||
locals {
|
locals {
|
||||||
identifier = var.identifier
|
identifier = var.identifier
|
||||||
name = "tf-${local.identifier}"
|
example = "ingress"
|
||||||
|
project_name = "tf-${substr(md5(join("-", [local.example, random_pet.string.id])), 0, 5)}-${local.identifier}"
|
||||||
zone = var.zone
|
zone = var.zone
|
||||||
domain = "${local.identifier}.${local.zone}"
|
domain = "${local.identifier}.${local.zone}"
|
||||||
}
|
}
|
||||||
|
resource "random_pet" "string" {
|
||||||
|
keepers = {
|
||||||
|
# regenerate the pet name when the identifier changes
|
||||||
|
identifier = local.identifier
|
||||||
|
}
|
||||||
|
length = 1
|
||||||
|
}
|
||||||
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
||||||
module "this" {
|
module "this" {
|
||||||
source = "../../"
|
source = "../../"
|
||||||
vpc_name = local.name
|
vpc_name = "${local.project_name}-vpc"
|
||||||
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
||||||
security_group_name = local.name
|
security_group_name = "${local.project_name}-sg"
|
||||||
security_group_type = "egress"
|
security_group_type = "egress"
|
||||||
domain = local.domain
|
domain = local.domain
|
||||||
load_balancer_name = local.name
|
load_balancer_name = "${local.project_name}-lb"
|
||||||
load_balancer_access_cidrs = {
|
load_balancer_access_cidrs = {
|
||||||
application = {
|
application = {
|
||||||
port = 443
|
port = 443
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ terraform {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = ">= 5.11"
|
version = ">= 5.11"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = ">= 3.1"
|
||||||
|
}
|
||||||
acme = {
|
acme = {
|
||||||
source = "vancluever/acme"
|
source = "vancluever/acme"
|
||||||
version = ">= 2.0"
|
version = ">= 2.0"
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,23 @@ provider "acme" {
|
||||||
}
|
}
|
||||||
locals {
|
locals {
|
||||||
identifier = var.identifier
|
identifier = var.identifier
|
||||||
name = "tf-${local.identifier}"
|
example = "loadbalancer"
|
||||||
|
project_name = "tf-${substr(md5(join("-", [local.example, random_pet.string.id])), 0, 5)}-${local.identifier}"
|
||||||
|
}
|
||||||
|
resource "random_pet" "string" {
|
||||||
|
keepers = {
|
||||||
|
# regenerate the pet name when the identifier changes
|
||||||
|
identifier = local.identifier
|
||||||
|
}
|
||||||
|
length = 1
|
||||||
}
|
}
|
||||||
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
||||||
module "this" {
|
module "this" {
|
||||||
source = "../../"
|
source = "../../"
|
||||||
vpc_name = local.name
|
vpc_name = "${local.project_name}-vpc"
|
||||||
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
||||||
security_group_name = local.name
|
security_group_name = "${local.project_name}-sg"
|
||||||
security_group_type = "project"
|
security_group_type = "project"
|
||||||
load_balancer_name = local.name
|
load_balancer_name = "${local.project_name}-lb"
|
||||||
domain_use_strategy = "skip"
|
domain_use_strategy = "skip"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ terraform {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = ">= 5.11"
|
version = ">= 5.11"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = ">= 3.1"
|
||||||
|
}
|
||||||
acme = {
|
acme = {
|
||||||
source = "vancluever/acme"
|
source = "vancluever/acme"
|
||||||
version = ">= 2.0"
|
version = ">= 2.0"
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,22 @@ provider "acme" {
|
||||||
}
|
}
|
||||||
locals {
|
locals {
|
||||||
identifier = var.identifier
|
identifier = var.identifier
|
||||||
name = "tf-${local.identifier}"
|
example = "securitygroup"
|
||||||
|
project_name = "tf-${substr(md5(join("-", [local.example, random_pet.string.id])), 0, 5)}-${local.identifier}"
|
||||||
|
}
|
||||||
|
resource "random_pet" "string" {
|
||||||
|
keepers = {
|
||||||
|
# regenerate the pet name when the identifier changes
|
||||||
|
identifier = local.identifier
|
||||||
|
}
|
||||||
|
length = 1
|
||||||
}
|
}
|
||||||
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
||||||
module "this" {
|
module "this" {
|
||||||
source = "../../"
|
source = "../../"
|
||||||
vpc_name = local.name
|
vpc_name = "${local.project_name}-vpc"
|
||||||
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
||||||
security_group_name = local.name
|
security_group_name = "${local.project_name}-sg"
|
||||||
security_group_type = "project"
|
security_group_type = "project"
|
||||||
load_balancer_use_strategy = "skip" # everything depending on load balancer is skipped implicitly
|
load_balancer_use_strategy = "skip" # everything depending on load balancer is skipped implicitly
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ terraform {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = ">= 5.11"
|
version = ">= 5.11"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = ">= 3.1"
|
||||||
|
}
|
||||||
acme = {
|
acme = {
|
||||||
source = "vancluever/acme"
|
source = "vancluever/acme"
|
||||||
version = ">= 2.0"
|
version = ">= 2.0"
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,22 @@ provider "acme" {
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
identifier = var.identifier
|
identifier = var.identifier
|
||||||
name = "tf-${local.identifier}"
|
example = "selectvpc"
|
||||||
|
project_name = "tf-${substr(md5(join("-", [local.example, random_pet.string.id])), 0, 5)}-${local.identifier}"
|
||||||
zone = var.zone
|
zone = var.zone
|
||||||
domain = "${local.identifier}.${local.zone}"
|
domain = "${local.identifier}.${local.zone}"
|
||||||
}
|
}
|
||||||
|
resource "random_pet" "string" {
|
||||||
|
keepers = {
|
||||||
|
# regenerate the pet name when the identifier changes
|
||||||
|
identifier = local.identifier
|
||||||
|
}
|
||||||
|
length = 1
|
||||||
|
}
|
||||||
|
|
||||||
module "setup" {
|
module "setup" {
|
||||||
source = "../../"
|
source = "../../"
|
||||||
vpc_name = local.name
|
vpc_name = "${local.project_name}-vpc"
|
||||||
vpc_cidr = "10.0.255.0/24"
|
vpc_cidr = "10.0.255.0/24"
|
||||||
subnet_use_strategy = "skip"
|
subnet_use_strategy = "skip"
|
||||||
}
|
}
|
||||||
|
|
@ -32,8 +40,8 @@ module "this" {
|
||||||
source = "../../"
|
source = "../../"
|
||||||
vpc_use_strategy = "select"
|
vpc_use_strategy = "select"
|
||||||
vpc_name = module.setup.vpc.tags.Name
|
vpc_name = module.setup.vpc.tags.Name
|
||||||
security_group_name = local.name
|
security_group_name = "${local.project_name}-sg"
|
||||||
security_group_type = "egress"
|
security_group_type = "egress"
|
||||||
load_balancer_name = local.name
|
load_balancer_name = "${local.project_name}-lb"
|
||||||
domain = local.domain
|
domain = local.domain
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ terraform {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = ">= 5.11"
|
version = ">= 5.11"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = ">= 3.1"
|
||||||
|
}
|
||||||
acme = {
|
acme = {
|
||||||
source = "vancluever/acme"
|
source = "vancluever/acme"
|
||||||
version = ">= 2.0"
|
version = ">= 2.0"
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ terraform {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = ">= 5.11"
|
version = ">= 5.11"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = ">= 3.1"
|
||||||
|
}
|
||||||
acme = {
|
acme = {
|
||||||
source = "vancluever/acme"
|
source = "vancluever/acme"
|
||||||
version = ">= 2.0"
|
version = ">= 2.0"
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,20 @@ provider "acme" {
|
||||||
}
|
}
|
||||||
locals {
|
locals {
|
||||||
identifier = var.identifier
|
identifier = var.identifier
|
||||||
name = "tf-${local.identifier}"
|
example = "subnets"
|
||||||
|
project_name = "tf-${substr(md5(join("-", [local.example, random_pet.string.id])), 0, 5)}-${local.identifier}"
|
||||||
|
}
|
||||||
|
resource "random_pet" "string" {
|
||||||
|
keepers = {
|
||||||
|
# regenerate the pet name when the identifier changes
|
||||||
|
identifier = local.identifier
|
||||||
|
}
|
||||||
|
length = 1
|
||||||
}
|
}
|
||||||
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
||||||
module "this" {
|
module "this" {
|
||||||
source = "../../"
|
source = "../../"
|
||||||
vpc_name = local.name
|
vpc_name = "${local.project_name}-vpc"
|
||||||
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
||||||
subnets = {
|
subnets = {
|
||||||
"subnetA" = {
|
"subnetA" = {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ terraform {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = ">= 5.11"
|
version = ">= 5.11"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = ">= 3.1"
|
||||||
|
}
|
||||||
acme = {
|
acme = {
|
||||||
source = "vancluever/acme"
|
source = "vancluever/acme"
|
||||||
version = ">= 2.0"
|
version = ">= 2.0"
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,20 @@ provider "acme" {
|
||||||
}
|
}
|
||||||
locals {
|
locals {
|
||||||
identifier = var.identifier
|
identifier = var.identifier
|
||||||
name = "tf-${local.identifier}"
|
example = "vpc"
|
||||||
|
project_name = "tf-${substr(md5(join("-", [local.example, random_pet.string.id])), 0, 5)}-${local.identifier}"
|
||||||
|
}
|
||||||
|
resource "random_pet" "string" {
|
||||||
|
keepers = {
|
||||||
|
# regenerate the pet name when the identifier changes
|
||||||
|
identifier = local.identifier
|
||||||
|
}
|
||||||
|
length = 1
|
||||||
}
|
}
|
||||||
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
# AWS reserves the first four IP addresses and the last IP address in any CIDR block for its own use (cumulatively)
|
||||||
module "this" {
|
module "this" {
|
||||||
source = "../../"
|
source = "../../"
|
||||||
vpc_name = local.name
|
vpc_name = "${local.project_name}-vpc"
|
||||||
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
vpc_cidr = "10.0.255.0/24" # gives 256 usable addresses from .1 to .254, but AWS reserves .1 to .4 and .255, leaving .5 to .254
|
||||||
subnet_use_strategy = "skip" # everything depending on subnet is skipped implicitly
|
subnet_use_strategy = "skip" # everything depending on subnet is skipped implicitly
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ terraform {
|
||||||
source = "hashicorp/aws"
|
source = "hashicorp/aws"
|
||||||
version = ">= 5.11"
|
version = ">= 5.11"
|
||||||
}
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = ">= 3.1"
|
||||||
|
}
|
||||||
acme = {
|
acme = {
|
||||||
source = "vancluever/acme"
|
source = "vancluever/acme"
|
||||||
version = ">= 2.0"
|
version = ">= 2.0"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue