aws_ec2.Instance: Generates dependency on role even after removal
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
I'm trying to prevent the Instance class from generating a new role because the environment I'm deploying to prevents me from creating the cloudformation service-role which can create IAM roles/instance profiles. I'm able to remove the instance profile and role ( which is very hacky, and honestly I'm not sure why it is generated by default, and why there is no way to just say don't remove it ), but even after doing so, the instance class still generates the dependency, This causes a dependency error when the changeset is deployed.
### Expected Behavior
I expect there to be no dependency generated when I remove the instance profile and role. And I know I can sort of prevent this behavior with customize_roles, but that still demands a role.
### Current Behavior
Generates a "depends-on" entry in the instance resource in the cloudformation template.
### Reproduction Steps
My code for testing this is here: [rke2-testing](https://github.com/abstractalchemist/rke2-testingl)
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.147.0 (build 3338fc0)
### Framework Version
_No response_
### Node.js Version
v20.10.0
### OS
Fedora 30
### Language
Python
### Language Version
3.12.3
### Other information
_No response_
Contributor guide
Research direction
The entry point is aws_ec2.Instance; reproduce the synthesized CloudFormation from the linked rke2-testing example with the instance profile and role removed. Inspect how the instance's depends-on entry is generated, and verify that the resulting template contains no dependency when both are removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, node.js, python, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100