-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: sanitized cluster name when using existing (#160)
due to #159 , a bug was introduced for the usage of existing ecs_cluster name. renamed field to `sanitized_cluster_name` for clarity, and protected it to fit both use-cases. more in depth explanation - input-variable format is `foo` - while data format for the cluster_name is `arn:aws:ecs:eu-west-3:425287181461:cluster/foo`. for the ECS autoscale, we just need `foo`. not sure about why data is so non-useful ¯\_(ツ)_/¯ ``` $ terraform state show module.aws_cloudvision_single_account.module.cloud_connector.data.aws_ecs_cluster.this data "aws_ecs_cluster" "this" { arn = "arn:aws:ecs:eu-west-3:425287181461:cluster/foo" cluster_name = "arn:aws:ecs:eu-west-3:425287181461:cluster/foo" id = "arn:aws:ecs:eu-west-3:425287181461:cluster/foo" ... } ```
- Loading branch information
iru
authored
Jan 31, 2023
1 parent
0ce09a9
commit 301ecd9
Showing
4 changed files
with
13 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
locals { | ||
deploy_image_scanning = var.deploy_image_scanning_ecs || var.deploy_image_scanning_ecr || var.deploy_beta_image_scanning_ecr | ||
deploy_image_scanning_with_codebuild = (var.deploy_image_scanning_ecs || var.deploy_image_scanning_ecr) && !var.deploy_beta_image_scanning_ecr | ||
|
||
verify_ssl = var.verify_ssl == "auto" ? length(regexall("https://.*?\\.sysdig(cloud)?.com/?", data.sysdig_secure_connection.current.secure_url)) == 1 : var.verify_ssl == "true" | ||
|
||
# this must satisfy input provided existing cluster ARNs and just created cluster format | ||
# ex. input var: 'foo' | ||
# ex. just created cluster name, gathered through tf data : 'arn:aws:ecs:eu-west-3:425287181461:cluster/foo' | ||
sanitized_cluster_name = coalesce(split("/", join("/", [var.ecs_cluster_name, ""]))[1], var.ecs_cluster_name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
data "aws_region" "current" {} | ||
|
||
locals { | ||
verify_ssl = var.verify_ssl == "auto" ? length(regexall("https://.*?\\.sysdig(cloud)?.com/?", data.sysdig_secure_connection.current.secure_url)) == 1 : var.verify_ssl == "true" | ||
cluster_name = coalesce(split("/", var.ecs_cluster_name)[1], var.ecs_cluster_name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters