ec2.LaunchTemplate launch_template_name property returns None
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### What is the problem?
ec2.LaunchTemplate has a property `launch_template_name`. This property is required to then pass the launch template name onto the `batch.LaunchTemplateSpecification` (I'm using aws_batch_alpha v2.12.0a), since I cannot directly pass the ec2.LaunchTemplate onto the `batch.ComputeResources` arguments.
### Reproduction Steps
```python
class Example(cdk.Stack):
def __init__(self, scope, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
launch_template = ec2.LaunchTemplate(
self,
"MyLT",
block_devices=[
ec2.BlockDevice(
device_name="/dev/xvdb",
volume=ec2.BlockDeviceVolume.ebs(
volume_size=300,
encrypted=True,
volume_type=ec2.EbsDeviceVolumeType.GP3,
),
)
],
)
assert launch_template.launch_template_name is not None
```
### What did you expect to happen?
The assert to not fail.
Interestingly enough, the `launch_template_name` is still `None` even when specifying the `launch_template_name` in the `ec2.LaunchTemplate`. This way it can quite easily be worked around. Just specify the name and then use this same name in the `batch.LaunchTemplateSpecification`.
### What actually happened?
Assert failed:
```
assert launch_template.launch_template_name is not None
AssertionError
```
### CDK CLI Version
2.12.0
### Framework Version
2.12.0
### Node.js Version
v16.13.0
### OS
ubuntu 20.04 (WSL)
### Language
Python
### Language Version
Python 3.8.12
### Other information
_No response_
Contributor guide
Research direction
Start by tracing ec2.LaunchTemplate.launch_template_name and compare its behavior when no name is supplied with the explicitly named case. Check how the resulting value is passed to batch.LaunchTemplateSpecification, and verify that the reproduction assertion succeeds in both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100