-
Notifications
You must be signed in to change notification settings - Fork 4
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
IT-4243: fix region lookup #21
Conversation
app.py
Outdated
certificate_account_id=environment_variables["CERTIFICATE_ACCOUNT_ID"], | ||
certificate_resource_id=environment_variables["CERTIFICATE_RESOURCE_ID"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that this solution requires setting tags because it's kinda a jenky work around.
# https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_ec2/Instance.html | ||
self.instance = ec2.Instance( | ||
self, | ||
"BastionHost", | ||
instance_type=props.instance_type, | ||
machine_image=ec2.MachineImage.generic_linux( | ||
{props.ami_region: props.ami_id} | ||
{region_json.to_string(): props.ami_id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you can reference with self.region
in LoadBalancedServiceStack then you can probably do the same here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using self.region
as the key in a map causes this error -- RuntimeError: Error: "${Token[AWS.Region.11]}" is used as the key in a map so must resolve to a string, but it resolves to: {"Ref":"AWS::Region"}. Consider using "CfnJson" to delay resolution to deployment-time
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wacko! i'm not a fan of CfnJson workaround but it works so let's just move on for now.
# https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_ec2/Instance.html | ||
self.instance = ec2.Instance( | ||
self, | ||
"BastionHost", | ||
instance_type=props.instance_type, | ||
machine_image=ec2.MachineImage.generic_linux( | ||
{props.ami_region: props.ami_id} | ||
{region_json.to_string(): props.ami_id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wacko! i'm not a fan of CfnJson workaround but it works so let's just move on for now.
Description
PR #19 included a global var for the AWS region that looked up the value from
aws_cdk.App().region
. However, this returnsNone
, so the workflow job failed. This PR will instead get the region value from the workflow input.