Inline Comment

Insert a comment listing valid values when the correct fix is ambiguous—for example, when several AMIs are acceptable.

Prompt

The following can be used with the gomboc-enterprise-skills.

/gomboc:fix

I want to create an ORL rule that checks that the AMI used for EC2 instances or launch templates is one of the following:

- ami-0a1b2c3d4e5f67890
- ami-0987654321fedcba0
- ami-0ff11223344556677
- ami-0abcdef1234567890
- ami-0123456789abcdef0

If the value is not one of those, then add a comment before the AMI attribute listing the valid values.

**Important**: The rule should be idempotent.  When testing, make sure to run the test on the remediated workspace to ensure it is unchanged on the second run.

Use /gomboc-community:fix if you have the gomboc-community-skills installed.

For this type of rule is important to tell the fix that rule needs to be idempotent becuase the fix and check are different. ORL doesn't normally need this flag since it patches what it checks and idempotency is built in; which is not the case with this type of rule.

Rule Output Example

Each rule matches one resource type and its AMI attribute. skip_finding passes when the value is valid or the comment is already present; otherwise, the comment is inserted before the attribute.

Last updated