Description
I'm trying to referring an existing AutoScalingGroup from my CodeDeploy with AutoScalingGroup.from_auto_scaling_group_name static method in order to integrate with CodePipeline for automating EC2/On-premise deployment. However, the Role from AutoScalingGroup is not being imported.
Reproduction Steps
-
Refer existing AutoScaling Group:
asg_1 = autoscaling.AutoScalingGroup.from_auto_scaling_group_name(self, "AutoScaleGroup", "WSAutoscaleStack-webServerAsgIdASG12345-XXXXXX")
-
EC2 Deployment Groups:
deployment_group = codedeploy.ServerDeploymentGroup(self, "CodeDeployDeploymentGroup", deployment_group_name="MyDeploymentGroup", install_agent=True, auto_scaling_groups=[asg_1])
What did you expect to happen?
Ideally, the referenced resource should be imported as an object, so that I can use it all dependents including iam.role from the resource. (c.f. from CodeDeploy Application Environment configuration, choose the Amazon EC2 Auto Scaling group where the current application revision is deployed)
What actually happened?
The error that I'm getting is as follows:
jsii.errors.JSIIError: Cannot get policy fragment of AMIPipelineStack/AutoScaleGroup, resource imported without a role
Environment
- CDK CLI Version : 1.94.0 (build 2c1c0eb)
- Framework Version:
- Node.js Version: v15.11.0
- OS : macOS Catalina
- Language (Version): Python (3.8.7)
Other
This issue was posted and confirmed. The issue is linked,
https://stackoverflow.com/questions/66748035/refer-import-existing-autoscalinggroup-resource-from-cdk-stack
This is 🐛 Bug Report