π§ AWS EC2 Auto Scaling Group Launch Template is not configured to require IMDSv2 - prod.logic.yamlπ’
- Contextual name: π§ prod.logic.yamlπ’
- ID:
/ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml - Tags:
- π’ Logic test success
- π’ Logic with extracts
- π’ Logic with test data
Usesβ
- π AWS EC2 Auto Scaling Group
- π AWS EC2 Launch Template Version - object.extracts.yaml
- π AWS EC2 Auto Scaling Group - object.extracts.yaml
- π§ͺ test-data.json
Test Results π’β
Generated at: 2026-02-10T22:32:33.240055979Z Open
| Result | Id | Condition Index | Condition Text | Runtime Error |
|---|---|---|---|---|
| π’ | test1 | βοΈ 99 | βοΈ isDisappeared(CA10__disappearanceTime__c) | βοΈ null |
| π’ | test2 | βοΈ 199 | βοΈ extract('CA10__launchConfigurationName__c').isNotEmpty() | βοΈ null |
| π’ | test3 | βοΈ 299 | βοΈ extract('CA10A1__launchTemplateId__c').isNotEmpty() && (isEmptyLookup('CA10A1__launchTemplate__r') || isEmptyLookup('CA10A1__launchTemplate__r.CA10A1__latestVersion__r')) | βοΈ null |
| π’ | test4 | βοΈ 299 | βοΈ extract('CA10A1__launchTemplateId__c').isNotEmpty() && (isEmptyLookup('CA10A1__launchTemplate__r') || isEmptyLookup('CA10A1__launchTemplate__r.CA10A1__latestVersion__r')) | βοΈ null |
| π’ | test5 | βοΈ 399 | βοΈ extract('CA10A1__mixedInstancesLaunchTemplateId__c').isNotEmpty() && (isEmptyLookup('CA10A1__mixedInstancesLaunchTemplate__r') || isEmptyLookup('CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r')) | βοΈ null |
| π’ | test6 | βοΈ 399 | βοΈ extract('CA10A1__mixedInstancesLaunchTemplateId__c').isNotEmpty() && (isEmptyLookup('CA10A1__mixedInstancesLaunchTemplate__r') || isEmptyLookup('CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r')) | βοΈ null |
| π’ | test7 | βοΈ 499 | βοΈ extract('CA10A1__launchTemplateId__c').isNotEmpty() && extract('CA10A1__launchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpEndpoint__c') == 'disabled' | βοΈ null |
| π’ | test8 | βοΈ 599 | βοΈ extract('CA10A1__mixedInstancesLaunchTemplateId__c').isNotEmpty() && extract('CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpEndpoint__c') == 'disabled' | βοΈ null |
| π’ | test9 | βοΈ 699 | βοΈ extract('CA10A1__launchTemplateId__c').isNotEmpty() && extract('CA10A1__launchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpTokens__c') == 'required' | βοΈ null |
| π’ | test10 | βοΈ 799 | βοΈ extract('CA10A1__mixedInstancesLaunchTemplateId__c').isNotEmpty() && extract('CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpTokens__c') == 'required' | βοΈ null |
| π’ | test11 | βοΈ 800 | βοΈ otherwise | βοΈ null |
| π’ | test12 | βοΈ 800 | βοΈ otherwise | βοΈ null |
Generation Bundleβ
| File | MD5 | |
|---|---|---|
| Open | /ce/ca/aws/autoscaling/group-launch-template-imdsv2/policy.yaml | 2BA738690B9315E9C7CB7C6FC7A0EDC5 |
| Open | /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml | AFB5538DDF7C893F449003320F21C6DD |
| Open | /ce/ca/aws/autoscaling/group-launch-template-imdsv2/test-data.json | 30BAABD8C965221D8C82CE87D97F01E4 |
| Open | /types/CA10A1__CaAwsEc2LaunchTemplateVersion__c/object.extracts.yaml | 0CF0050EB6BA851041A4284E9AEA6611 |
| Open | /types/CA10__CaAwsAutoScalingGroup__c/object.extracts.yaml | DD26D73C0CF43F8CE9CBE35D8241D89C |
Available Commandsβ
repo-manager policies generate FULL /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml
repo-manager policies generate DEBUG /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml
repo-manager policies generate CAPTURE_TEST_DATA /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml
repo-manager policies generate TESTS /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml
# Execute tests
repo-manager policies test /ce/ca/aws/autoscaling/group-launch-template-imdsv2/prod.logic.yaml
Contentβ
---
inputType: "CA10__CaAwsAutoScalingGroup__c"
importExtracts:
- file: "/types/CA10A1__CaAwsEc2LaunchTemplateVersion__c/object.extracts.yaml"
- file: "/types/CA10__CaAwsAutoScalingGroup__c/object.extracts.yaml"
testData:
- file: "test-data.json"
conditions:
- status: "INAPPLICABLE"
currentStateMessage: "The Auto Scaling group uses a launch configuration."
remediationMessage: "Migrate the Auto Scaling group to a launch template."
check:
NOT_EMPTY:
arg:
EXTRACT: "CA10__launchConfigurationName__c"
- status: "UNDETERMINED"
currentStateMessage: "The launch template is not present in the CMDB."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__launchTemplateId__c"
- OR:
args:
- IS_EMPTY_LOOKUP: "CA10A1__launchTemplate__r"
- IS_EMPTY_LOOKUP: "CA10A1__launchTemplate__r.CA10A1__latestVersion__r"
- status: "UNDETERMINED"
currentStateMessage: "The launch template is not present in the CMDB."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplateId__c"
- OR:
args:
- IS_EMPTY_LOOKUP: "CA10A1__mixedInstancesLaunchTemplate__r"
- IS_EMPTY_LOOKUP: "CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r"
- status: "INCOMPLIANT"
currentStateMessage: "Access to the HTTP endpoint of the instance metadata service is disabled."
remediationMessage: "Enable access to the instance metadata service."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__launchTemplateId__c"
- IS_EQUAL:
left:
EXTRACT: "CA10A1__launchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpEndpoint__c"
right:
TEXT: "disabled"
- status: "INCOMPLIANT"
currentStateMessage: "Access to the HTTP endpoint of the instance metadata service is disabled."
remediationMessage: "Enable access to the instance metadata service."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplateId__c"
- IS_EQUAL:
left:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpEndpoint__c"
right:
TEXT: "disabled"
- status: "COMPLIANT"
currentStateMessage: "The launch template settings require IMDSv2."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__launchTemplateId__c"
- IS_EQUAL:
left:
EXTRACT: "CA10A1__launchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpTokens__c"
right:
TEXT: "required"
- status: "COMPLIANT"
currentStateMessage: "The launch template settings require IMDSv2."
check:
AND:
args:
- NOT_EMPTY:
arg:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplateId__c"
- IS_EQUAL:
left:
EXTRACT: "CA10A1__mixedInstancesLaunchTemplate__r.CA10A1__latestVersion__r.CA10A1__metadataHttpTokens__c"
right:
TEXT: "required"
otherwise:
status: "INCOMPLIANT"
currentStateMessage: "IMDSv2 is not required when requesting instance metadata."
remediationMessage: "Configure the template to require IMDSv2."