Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Region to CF Bucket Endpoint URL #802

Merged
merged 4 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions conductor/src/aws/cloudformation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,21 @@ impl AWSConfigState {
stack_name: &str,
params: &CloudFormationParams,
cloudformation_template_bucket: String,
aws_region: String,
) -> Result<(), ConductorError> {
let template_url = format!(
"https://{}.s3.amazonaws.com/{}",
cloudformation_template_bucket, "conductor-cf-template-v2.yaml"
);
// If region is us-east-1, we don't need to specify the region in the template url
let template_url = if aws_region == "us-east-1" {
format!(
"https://{}.s3.amazonaws.com/{}",
cloudformation_template_bucket, "conductor-cf-template-v2.yaml"
)
} else {
format!(
"https://{}.s3.{}.amazonaws.com/{}",
cloudformation_template_bucket, aws_region, "conductor-cf-template-v2.yaml"
)
};

let parameters = params.clone().parameters();
if !self.does_stack_exist(stack_name).await {
// todo(nhudson): We need to add tags to the stack
Expand Down
9 changes: 7 additions & 2 deletions conductor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ pub async fn create_cloudformation(
// back to the queue.
// If there is an error we will need to alert on it
// If we are still waiting for the stack to be created we will need to requeue the message
let region = Region::new(aws_region);
let region = Region::new(aws_region.clone());
let aws_config_state = AWSConfigState::new(region).await;
let stack_name = format!("{}-cf", namespace);
let iam_role_name = format!("{}-iam", namespace);
Expand All @@ -416,7 +416,12 @@ pub async fn create_cloudformation(
service_account_name,
};
aws_config_state
.create_cloudformation_stack(&stack_name, &cf_template_params, cf_template_bucket)
.create_cloudformation_stack(
&stack_name,
&cf_template_params,
cf_template_bucket,
aws_region,
)
.await
.map_err(ConductorError::from)?;
Ok(())
Expand Down
Loading