Open brhubbar opened 2 weeks ago
Thanks for submitting. We will remove this for now. This will become a more complicated check. We may be able to follow the LaunchTemplate to the other resource to see if ImageId is specified but this isn't something we can just have in a json schema type check.
This PR will remove the false positive. As mentioned above I will need to add a new rule with some cross resource logic to determine if the ImageID is specified in the LaunchTemplate. This can take a little bit of work as we need to handle conditions, etc. We will keep this issue open until we get this fully resolved.
Thanks for the quick response! I always forget my manners when I open these bug reports, so I wanted to circle back and express my gratitude for all the work you've put into cfn-lint
- it's a fantastic tool and one I refer my colleagues to regularly.
CloudFormation Lint Version
v1.5.0
What operating system are you using?
Ubuntu
Describe the bug
This is similar to #3319 - as of upgrading to v1, I get
E3014
when providing anImageId
and aLaunchTemplate
for an EC2 instance. This has deployed successfully in the past, not to mention that myLaunchTemplate
does not (and is not required to) define anImageId
. Per the docs:Secondly, if I do not specify an
ImageId
in either spec, but provide aLaunchTemplate
, I get no error, even though, per the docs:Expected behavior
ImageId
may be defined onAWS::EC2::Instance
regardless of whetherLaunchTemplate
is specifiedImageId
must be defined onAWS::EC2::Instance
ifLaunchTemplate
is not specifiedImageId
must be defined onAWS::EC2::Instance
ifLaunchTemplate
is specified, but the linked template does not specify anImageId
.Reproduction template