Type error on SSM Document For each loop

0

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.

已提問 1 個月前檢視次數 96 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南