Hello,
I am currently trying to create my custom SSM document that aims to create/delete VPC Endpoints when needed. The problem is that I don't understand of to iterate over a MapList with SSM Document.
The sample input that I used is :
[
{
"VpcId": "vpc-*",
"SubnetIds": ["subnet-*"],
"ServiceName": "com.amazonaws.eu-west-3.s3",
"Name": "TestEndpoint"
},
{
"VpcId": "vpc-*",
"SubnetIds": ["subnet-*"],
"ServiceName": "com.amazonaws.eu-west-3.dynamodb",
"Name": "TestEndpoint2"
}
]
With the Document content :
schemaVersion: '0.3'
description: |-
*Replace this default text with instructions or other information about your runbook.*
parameters:
VpcEndpoints:
type: MapList
mainSteps:
- name: Loop
action: aws:loop
isEnd: true
inputs:
Iterators: '{{ VpcEndpoints }}'
IteratorDataType: StringMap
Steps:
- name: CreateVpcEndpoint
action: aws:executeAwsApi
isEnd: true
inputs:
Service: ec2
Api: CreateVpcEndpoint
VpcEndpointType: Interface
VpcId: '{{ Loop.CurrentIteratorValue }}.VcpId'
SubnetIds: '{{ Loop.CurrentIteratorValue }}.SubnetIds'
ServiceName: '{{ Loop.CurrentIteratorValue }}.ServiceName'
TagSpecifications:
- ResourceType: vpc-endpoint
Tags:
- Key: Name
Value: '{{ Loop.CurrentIteratorValue }}.Name'
And I finally received this error :
Step fails when it is validating and resolving the step inputs. Failed to resolve input: VpcEndpoints to type StringList. VpcEndpoints is found to be of type MapList.. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.
I am not sure where is my misunderstanding in the parameters type and searching for someone that already tried to iterate over a MapList within an SSM Document.