Skip to content

Commit

Permalink
use name instead of random-id
Browse files Browse the repository at this point in the history
  • Loading branch information
wellsiau-aws committed Dec 20, 2023
1 parent 77cbfc1 commit 44fa2df
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
5 changes: 5 additions & 0 deletions blueprints/01-getting-started/.auto.tfvars.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# name = "random-id" # Optional, enter unique name / random id here
region = "us-east-1" # Required, change this according to your target region
domain_name = "example.domain.com" # Required. Domain name used by the CloudBees CI instance.

temp_license = { # Required. Temporary license details.
Expand All @@ -12,3 +14,6 @@ temp_license = { # Required. Temporary license details.
# "cb-user" : "crodriguezlopez"
# "cb-environment" : "demo"
# }

# k8s_version = "1.27" Optional
# vpc_cidr = "10.0.0.0/16" Optional
13 changes: 4 additions & 9 deletions blueprints/01-getting-started/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ data "aws_route53_zone" "this" {
data "aws_availability_zones" "available" {}

locals {
name = "cbci-bp01-i${random_integer.ramdom_id.result}"
region = "us-east-1"
name = "cbci-bp-${var.name}"
region = var.region

vpc_name = "${local.name}-vpc"
cluster_name = "${local.name}-eks"
kubeconfig_file = "kubeconfig_${local.name}.yaml"
kubeconfig_file_path = abspath("${path.root}/${local.kubeconfig_file}")

vpc_cidr = "10.0.0.0/16"
vpc_cidr = var.vpc_cidr

#https://docs.cloudbees.com/docs/cloudbees-common/latest/supported-platforms/cloudbees-ci-cloud#_kubernetes
k8s_version = "1.26"
k8s_version = var.k8s_version

route53_zone_id = data.aws_route53_zone.this.id
route53_zone_arn = data.aws_route53_zone.this.arn
Expand All @@ -31,11 +31,6 @@ locals {
})
}

resource "random_integer" "ramdom_id" {
min = 1
max = 999
}

################################################################################
# EKS: Add-ons
################################################################################
Expand Down
30 changes: 30 additions & 0 deletions blueprints/01-getting-started/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
variable "name" {
description = "Unique name to be assigned to all resources"
default = ""
type = string
}

variable "region" {
description = "The region from which this module will be executed."
type = string
validation {
condition = can(regex("(us(-gov)?|ap|ca|cn|eu|sa)-(central|(north|south)?(east|west)?)-\\d", var.region))
error_message = "Variable var: region is not valid."
}
}

variable "tags" {
description = "Tags to apply to resources"
Expand All @@ -18,3 +32,19 @@ variable "temp_license" {
description = "Temporary license details"
type = map(string)
}

variable "k8s_version" {
description = "EKS cluster version, refer to: https://docs.cloudbees.com/docs/cloudbees-common/latest/supported-platforms/cloudbees-ci-cloud#_kubernetes "
type = string
default = "1.26"
}

variable "vpc_cidr" {
description = "CIDR for the EKS cluster VPC"
type = string
default = "10.0.0.0/16"
validation {
condition = can(cidrhost(var.vpc_cidr, 0))
error_message = "Must be valid IPv4 CIDR."
}
}

0 comments on commit 44fa2df

Please sign in to comment.