From b1fa018c36ce957dc35639c54333706b8de91aaf Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Fri, 15 Oct 2021 09:49:57 -0700 Subject: [PATCH] Don't hard-code the SQS Queue ARN partition --- pkg/model/awsmodel/nodeterminationhandler.go | 3 ++- .../update_cluster/nth_sqs_resources/cloudformation.json | 8 ++++---- .../update_cluster/nth_sqs_resources/kubernetes.tf | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/model/awsmodel/nodeterminationhandler.go b/pkg/model/awsmodel/nodeterminationhandler.go index b2c2f13267..3b2054fd28 100644 --- a/pkg/model/awsmodel/nodeterminationhandler.go +++ b/pkg/model/awsmodel/nodeterminationhandler.go @@ -140,9 +140,10 @@ func (b *NodeTerminationHandlerBuilder) buildSQSQueue(c *fi.ModelBuilderContext) func (b *NodeTerminationHandlerBuilder) buildEventBridgeRules(c *fi.ModelBuilderContext) error { clusterName := b.ClusterName() queueName := model.QueueNamePrefix(clusterName) + "-nth" + partition := b.AWSPartition region := b.Region accountID := b.AWSAccountID - targetArn := "arn:aws:sqs:" + region + ":" + accountID + ":" + queueName + targetArn := "arn:" + partition + ":sqs:" + region + ":" + accountID + ":" + queueName clusterNamePrefix := awsup.GetClusterName40(clusterName) for _, event := range events { diff --git a/tests/integration/update_cluster/nth_sqs_resources/cloudformation.json b/tests/integration/update_cluster/nth_sqs_resources/cloudformation.json index ffdb117ad3..e29abe079c 100644 --- a/tests/integration/update_cluster/nth_sqs_resources/cloudformation.json +++ b/tests/integration/update_cluster/nth_sqs_resources/cloudformation.json @@ -984,7 +984,7 @@ "Targets": [ { "Id": "1", - "Arn": "arn:aws:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" + "Arn": "arn:aws-test:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" } ] } @@ -1004,7 +1004,7 @@ "Targets": [ { "Id": "1", - "Arn": "arn:aws:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" + "Arn": "arn:aws-test:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" } ] } @@ -1024,7 +1024,7 @@ "Targets": [ { "Id": "1", - "Arn": "arn:aws:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" + "Arn": "arn:aws-test:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" } ] } @@ -1044,7 +1044,7 @@ "Targets": [ { "Id": "1", - "Arn": "arn:aws:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" + "Arn": "arn:aws-test:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" } ] } diff --git a/tests/integration/update_cluster/nth_sqs_resources/kubernetes.tf b/tests/integration/update_cluster/nth_sqs_resources/kubernetes.tf index 4aeb855784..6b778c6a52 100644 --- a/tests/integration/update_cluster/nth_sqs_resources/kubernetes.tf +++ b/tests/integration/update_cluster/nth_sqs_resources/kubernetes.tf @@ -265,22 +265,22 @@ resource "aws_cloudwatch_event_rule" "nthsqsresources-longclustername-e-fkbaoh-S } resource "aws_cloudwatch_event_target" "nthsqsresources-longclustername-e-fkbaoh-ASGLifecycle-Target" { - arn = "arn:aws:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" + arn = "arn:aws-test:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" rule = aws_cloudwatch_event_rule.nthsqsresources-longclustername-e-fkbaoh-ASGLifecycle.id } resource "aws_cloudwatch_event_target" "nthsqsresources-longclustername-e-fkbaoh-InstanceStateChange-Target" { - arn = "arn:aws:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" + arn = "arn:aws-test:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" rule = aws_cloudwatch_event_rule.nthsqsresources-longclustername-e-fkbaoh-InstanceStateChange.id } resource "aws_cloudwatch_event_target" "nthsqsresources-longclustername-e-fkbaoh-RebalanceRecommendation-Target" { - arn = "arn:aws:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" + arn = "arn:aws-test:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" rule = aws_cloudwatch_event_rule.nthsqsresources-longclustername-e-fkbaoh-RebalanceRecommendation.id } resource "aws_cloudwatch_event_target" "nthsqsresources-longclustername-e-fkbaoh-SpotInterruption-Target" { - arn = "arn:aws:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" + arn = "arn:aws-test:sqs:us-test-1:123456789012:nthsqsresources-longclustername-example-com-nth" rule = aws_cloudwatch_event_rule.nthsqsresources-longclustername-e-fkbaoh-SpotInterruption.id }