52 lines
1.4 KiB
YAML
52 lines
1.4 KiB
YAML
schemaVersion: '0.3'
|
|
mainSteps:
|
|
- name: GetParameter
|
|
action: aws:executeAwsApi
|
|
nextStep: ConvertInputToList
|
|
isEnd: false
|
|
# parameter contains comma separated ids (i.e. 111111111111,222222222222)
|
|
inputs:
|
|
Service: ssm
|
|
Api: GetParameter
|
|
Name: some-parameter
|
|
outputs:
|
|
- Name: Accounts
|
|
Selector: $.Parameter.Value
|
|
Type: String
|
|
# input needs to be transformed to a list of string in order to be used by aws:loop
|
|
- name: ConvertInputToList
|
|
action: aws:executeScript
|
|
nextStep: Loop
|
|
isEnd: false
|
|
inputs:
|
|
Runtime: python3.11
|
|
Handler: script_handler
|
|
InputPayload:
|
|
accounts: '{{ GetParameter.Accounts }}'
|
|
Script: |
|
|
def script_handler(events, context):
|
|
return events['accounts'].split(',')
|
|
outputs:
|
|
- Name: AccountList
|
|
Selector: $.Payload
|
|
Type: StringList
|
|
- name: Loop
|
|
action: aws:loop
|
|
isEnd: true
|
|
inputs:
|
|
Iterators: '{{ ConvertInputToList.AccountList }}'
|
|
IteratorDataType: String
|
|
Steps:
|
|
- name: PrintInput
|
|
action: aws:executeScript
|
|
isEnd: true
|
|
inputs:
|
|
Runtime: python3.11
|
|
Handler: script_handler
|
|
InputPayload:
|
|
accountId: '{{Loop.CurrentIteratorValue}}'
|
|
Script: |
|
|
def script_handler(events,context):
|
|
return {"accountId": events.get('accountId')}
|
|
|