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 16, 2024
1 parent 6f067a5 commit 7e7fcaa
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 7e7fcaa

Please sign in to comment.