donnemartin / saws

A supercharged AWS command line interface (CLI).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make the json from cli-input-json takes proper json

felixgao opened this issue · comments

I am playing with the iam commands like

saws> aws iam create-role --cli-input-json file://test-saws-iam-role.json

The json file contains the following

{
        "AssumeRolePolicyDocument": "{ \"Statement\": [  { \"Effect\": \"Allow\", \"Principal\": { \"Service\": \"ec2.amazonaws.com\" }, \"Action\": \"sts:AssumeRole\" } ] }",
        "Path": "/",
        "RoleName": "iam-role-test"
}

Notice that I have to escape the values in AssumeRolePolicyDocument, if it is not escaped the following error cause the command to fail

Parameter validation failed:
Invalid type for parameter AssumeRolePolicyDocument, value: {'Statement': [{'Action': 'sts:AssumeRole', 'Principal': {'Service': 'ec2.amazonaws.com'}, 'Effect': 'Allow'}]}, type: <class 'dict'>, valid types: <class 'str'>

@felixgao thanks for the report. Does the same issue happen when you try to run the same command with aws-cli? Looking at the error log it seems this might not be local to SAWS.

The same thing happens when the command is run with aws-cli. And it still exists.

@seppestas appreciate for the note on this being an aws-cli issue, I think it will need to be addressed there.

If this is still a problem I would file a report in the aws-cli project. Thanks!