diff --git a/terraform/implementations/aws/observ-infra/aws.tfvars b/terraform/implementations/aws/observ-infra/aws.tfvars index 86a6ebe5..b7f2411d 100644 --- a/terraform/implementations/aws/observ-infra/aws.tfvars +++ b/terraform/implementations/aws/observ-infra/aws.tfvars @@ -76,7 +76,7 @@ enable_rancher_keycloak_integration = true # Rancher import (same as infra) enable_rancher_import = false -rancher_import_url = "\"\"" +rancher_import_url = "" # Security group CIDRs network_cidr = "10.0.0.0/8" # Use your actual VPC CIDR diff --git a/terraform/infra/variables.tf b/terraform/infra/variables.tf index bdb44f2a..a2fc8781 100644 --- a/terraform/infra/variables.tf +++ b/terraform/infra/variables.tf @@ -84,14 +84,15 @@ variable "enable_rancher_import" { } variable "rancher_import_url" { - description = "Rancher import URL for kubectl apply" + description = "Rancher import URL for kubectl apply. Can be empty when enable_rancher_import is false." type = string + default = "" validation { condition = ( - can(regex("^\"kubectl apply -f https://rancher\\.mosip\\.net/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.rancher_import_url)) || - can(regex("^\"kubectl apply -f https://rancher\\.[a-zA-Z0-9\\*\\.\\-]+\\.net/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.rancher_import_url)) + var.rancher_import_url == "" || + can(regex("^\"kubectl apply -f https://[a-zA-Z0-9][a-zA-Z0-9\\-\\.]+[a-zA-Z0-9]\\.[a-zA-Z]{2,}/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.rancher_import_url)) ) - error_message = "The RANCHER_IMPORT_URL must be in the format: '\"kubectl apply -f https://rancher.mosip.net/v3/import/.yaml\"' or '\"kubectl apply -f https://rancher.***.net/v3/import/.yaml\"'" + error_message = "The rancher_import_url must be empty or in the format: '\"kubectl apply -f https:///v3/import/.yaml\"'" } } diff --git a/terraform/modules/aws/variables.tf b/terraform/modules/aws/variables.tf index bf5bd7a1..9b27bbe6 100644 --- a/terraform/modules/aws/variables.tf +++ b/terraform/modules/aws/variables.tf @@ -44,23 +44,16 @@ variable "ENABLE_RANCHER_IMPORT" { default = false } variable "RANCHER_IMPORT_URL" { - description = "Rancher import URL for kubectl apply" + description = "Rancher import URL for kubectl apply. Can be empty when ENABLE_RANCHER_IMPORT is false." type = string - + default = "" validation { condition = ( - can(regex("^\"kubectl apply -f https://rancher\\.mosip\\.net/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.RANCHER_IMPORT_URL)) || - can(regex("^\"kubectl apply -f https://rancher\\.[a-zA-Z0-9\\*\\.\\-]+\\.net/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.RANCHER_IMPORT_URL)) + var.RANCHER_IMPORT_URL == "" || + can(regex("^\"kubectl apply -f https://[a-zA-Z0-9][a-zA-Z0-9\\-\\.]+[a-zA-Z0-9]\\.[a-zA-Z]{2,}/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.RANCHER_IMPORT_URL)) ) - error_message = "The RANCHER_IMPORT_URL must be in the format: '\"kubectl apply -f https://rancher.mosip.net/v3/import/.yaml\"' or '\"kubectl apply -f https://rancher.***.net/v3/import/.yaml\"'" + error_message = "The RANCHER_IMPORT_URL must be empty or in the format: '\"kubectl apply -f https:///v3/import/.yaml\"'" } - # validation { - # condition = ( - # var.RANCHER_IMPORT_URL == "" || - # can(regex("^\"kubectl apply -f https://rancher\\.mosip\\.net/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.RANCHER_IMPORT_URL)) - # ) - # error_message = "The RANCHER_IMPORT_URL must be empty or in the format: '\"kubectl apply -f https://rancher.mosip.net/v3/import/.yaml\"'" - # } } variable "CLUSTER_ENV_DOMAIN" { diff --git a/terraform/observ-infra/variables.tf b/terraform/observ-infra/variables.tf index 10636c48..efe2fc97 100644 --- a/terraform/observ-infra/variables.tf +++ b/terraform/observ-infra/variables.tf @@ -86,14 +86,15 @@ variable "enable_rancher_import" { } variable "rancher_import_url" { - description = "Rancher import URL for kubectl apply" + description = "Rancher import URL for kubectl apply. Can be empty when enable_rancher_import is false." type = string + default = "" validation { condition = ( - can(regex("^\"kubectl apply -f https://rancher\\.mosip\\.net/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.rancher_import_url)) || - can(regex("^\"kubectl apply -f https://rancher\\.[a-zA-Z0-9\\*\\.\\-]+\\.net/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.rancher_import_url)) + var.rancher_import_url == "" || + can(regex("^\"kubectl apply -f https://[a-zA-Z0-9][a-zA-Z0-9\\-\\.]+[a-zA-Z0-9]\\.[a-zA-Z]{2,}/v3/import/[a-zA-Z0-9_\\-]+\\.yaml\"$", var.rancher_import_url)) ) - error_message = "The RANCHER_IMPORT_URL must be in the format: '\"kubectl apply -f https://rancher.mosip.net/v3/import/.yaml\"' or '\"kubectl apply -f https://rancher.***.net/v3/import/.yaml\"'" + error_message = "The rancher_import_url must be empty or in the format: '\"kubectl apply -f https:///v3/import/.yaml\"'" } }