Skip to content

Commit

Permalink
remove keep prefix and update api key logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Omolola-Akinleye committed Mar 27, 2024
1 parent 22a8be4 commit d567e3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ jobs:
fi
# Check pattern required for cloud deployment
if ! [[ $deployment_name =~ (^keep_[a-z][-a-z0-9]*|[a-z][-a-z0-9]*)$ ]]; then
echo "error: Deployment name doesn't match the required pattern QA env keep_[a-z][-a-z0-9]* or regular env [a-z][-a-z0-9]*"
if ! [[ $deployment_name =~ ([a-z][-a-z0-9]*)$ ]]; then
echo "error: Deployment name doesn't match the required pattern regular env [a-z][-a-z0-9]*"
exit 1
fi
Expand All @@ -177,7 +177,7 @@ jobs:
ec_url="${{ env.EC_URL }}"
# When user stores input ec api key then update Elastic Cloud env API KEY
if [[ $ec_api_key != '' && $input_ec_url == $ec_url ]]; then
if [[ $ec_api_key != '' ]]; then
echo "::add-mask::$ec_api_key"
echo "TF_VAR_ec_api_key=$ec_api_key" >> $GITHUB_ENV
elif [[ $input_ec_url == $ec_url ]]; then
Expand Down
5 changes: 2 additions & 3 deletions deploy/test-environments/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ locals {
project = "${var.project}"
owner = "${var.owner}"
}
deployment_name = replace(var.deployment_name, "keep-", "keep_")
ec_headers = {
Content-type = "application/json"
Authorization = "ApiKey ${var.ec_api_key}"
Expand Down Expand Up @@ -64,7 +63,7 @@ module "ec_deployment" {
tags = local.common_tags

deployment_template = var.deployment_template
deployment_name_prefix = "${local.deployment_name}-${random_string.suffix.result}"
deployment_name_prefix = "${var.deployment_name}-${random_string.suffix.result}"

elasticsearch_autoscale = true
elasticsearch_size = var.elasticsearch_size
Expand All @@ -89,7 +88,7 @@ module "ec_project" {
source = "../cloud/modules/serverless"
ec_apikey = var.ec_api_key
ec_url = var.ec_url
project_name = "${local.deployment_name}-${random_string.suffix.result}"
project_name = "${var.deployment_name}-${random_string.suffix.result}"
region_id = var.ess_region
}

Expand Down

0 comments on commit d567e3d

Please sign in to comment.