diff --git a/examples/terraform-examples/jfrog-platform-aws-install/eks.tf b/examples/terraform-examples/jfrog-platform-aws-install/eks.tf index 208116225..16cd9955c 100644 --- a/examples/terraform-examples/jfrog-platform-aws-install/eks.tf +++ b/examples/terraform-examples/jfrog-platform-aws-install/eks.tf @@ -1,7 +1,7 @@ # This file is used to create an AWS EKS cluster and the managed node group(s) locals { - cluster_name = var.cluster_name + cluster_name = "${var.cluster_name}-${random_pet.unique_name.id}" } resource "aws_security_group_rule" "allow_management_from_my_ip" { diff --git a/examples/terraform-examples/jfrog-platform-aws-install/jfrog-platform.tf b/examples/terraform-examples/jfrog-platform-aws-install/jfrog-platform.tf index 80e646bcf..ee3cf8664 100644 --- a/examples/terraform-examples/jfrog-platform-aws-install/jfrog-platform.tf +++ b/examples/terraform-examples/jfrog-platform-aws-install/jfrog-platform.tf @@ -15,7 +15,7 @@ provider "kubernetes" { # Fetch the JFrog Platform Helm chart and untar it to the current directory so we can use the sizing files to create the final values files resource "null_resource" "fetch_platform_chart" { provisioner "local-exec" { - command = "rm -rf xray-*.tgz" + command = "rm -rf jfrog-platform-*.tgz" } provisioner "local-exec" { command = "helm fetch jfrog-platform --version ${var.jfrog_platform_chart_version} --repo https://charts.jfrog.io --untar" @@ -98,7 +98,7 @@ resource "local_file" "jfrog_platform_values" { maxCacheSize: "${local.cache-fs-size}000000000" awsS3V3: region: "${var.region}" - bucketName: "artifactory-${var.region}-${var.s3_bucket_name_suffix}" + bucketName: "${local.artifactory_s3_bucket_name}" database: url: "jdbc:postgresql://${aws_db_instance.artifactory_db.endpoint}/${var.artifactory_db_name}?sslmode=require" diff --git a/examples/terraform-examples/jfrog-platform-aws-install/s3.tf b/examples/terraform-examples/jfrog-platform-aws-install/s3.tf index 4e5ded1af..8d62da2b7 100644 --- a/examples/terraform-examples/jfrog-platform-aws-install/s3.tf +++ b/examples/terraform-examples/jfrog-platform-aws-install/s3.tf @@ -1,7 +1,11 @@ # This file is used to create an S3 bucket for Artifactory to store binaries +locals { + artifactory_s3_bucket_name = "artifactory-${var.region}-${var.s3_bucket_name_suffix}-${random_pet.unique_name.id}" +} + resource "aws_s3_bucket" "artifactory_binarystore" { - bucket = "artifactory-${var.region}-${var.s3_bucket_name_suffix}" + bucket = local.artifactory_s3_bucket_name # WARNING: This will force the bucket to be destroyed even if it's not empty force_destroy = true diff --git a/examples/terraform-examples/jfrog-platform-aws-install/variables.tf b/examples/terraform-examples/jfrog-platform-aws-install/variables.tf index ea292ade2..485efb899 100644 --- a/examples/terraform-examples/jfrog-platform-aws-install/variables.tf +++ b/examples/terraform-examples/jfrog-platform-aws-install/variables.tf @@ -230,7 +230,7 @@ variable "xray_db_password" { } variable "cluster_name" { - default = "jfrog-eks-cluster" + default = "jfrog" } variable "namespace" { diff --git a/examples/terraform-examples/jfrog-platform-aws-install/vpc.tf b/examples/terraform-examples/jfrog-platform-aws-install/vpc.tf index 182577a9a..d861ec35c 100644 --- a/examples/terraform-examples/jfrog-platform-aws-install/vpc.tf +++ b/examples/terraform-examples/jfrog-platform-aws-install/vpc.tf @@ -7,10 +7,17 @@ data "aws_availability_zones" "available" { } } +resource "random_pet" "unique_name" { + keepers = { + # Generate a new pet name each time we switch to a new region + string = var.region + } +} + module "vpc" { source = "terraform-aws-modules/vpc/aws" - name = "jfrog-vpc-${random_pet.unique.id}" + name = "jfrog-vpc-${random_pet.unique_name.id}" cidr = var.vpc_cidr azs = slice(data.aws_availability_zones.available.names, 0, 3)