Skip to content

Commit

Permalink
Ensure EC2 role created first
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Jan 19, 2024
1 parent 84d1f7d commit 1fdfb39
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/ci/cdk/cdk/aws_lc_ec2_test_framework_ci_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,14 @@ def __init__(self,
iam.ManagedPolicy.from_aws_managed_policy_name("AmazonSSMManagedInstanceCore"),
iam.ManagedPolicy.from_aws_managed_policy_name("CloudWatchAgentServerPolicy")
])
iam.CfnInstanceProfile(scope=self, id="{}-ec2-profile".format(id),
cfn_instance_prof = iam.CfnInstanceProfile(scope=self, id="{}-ec2-profile".format(id),
roles=["{}-ec2-role".format(id)],
instance_profile_name="{}-ec2-profile".format(id))

cfn_ec2_role = iam.CfnRole( self, "CfnEc2Role",
assume_role_policy_document=ec2_role.assume_role_policy
)
cfn_instance_prof.add_depends_on(cfn_ec2_role)
# create vpc for ec2s
vpc = ec2.Vpc(self, id="{}-ec2-vpc".format(id))
selection = vpc.select_subnets()
Expand Down

0 comments on commit 1fdfb39

Please sign in to comment.