Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2 subcommand fails when given --tag-specifications #8720

Open
corey-cole opened this issue Jun 4, 2024 · 1 comment
Open

ec2 subcommand fails when given --tag-specifications #8720

corey-cole opened this issue Jun 4, 2024 · 1 comment
Labels
bug This issue is a bug. documentation This is a problem with documentation. ec2 p2 This is a standard priority issue

Comments

@corey-cole
Copy link

Describe the bug

This is a reopening of Issue #8211. Was able to verify that the behavior is present on multiple 2.x versions of the CLI across multiple operating systems.

Expected Behavior

AWS CLI commands should work when following the published documentation.

Current Behavior

AWS CLI command created following the published documentation fails with an unexpected error.

Reproduction Steps

# aws-cli/2.16.0 Python/3.11.9 Darwin/23.5.0 source/arm64
# Example from documentation with the only changes being specific VPC ID and CIDR block
aws ec2 create-subnet --vpc-id vpc-0d54e6a6aee42292c --cidr-block 10.21.16.0/20 --tag-specifications ResourceType=subnet,Tags=[{Key=Name,Value=my-ipv4-only-subnet}] --debug --region us-east-1
...
2024-06-04 14:02:12,031 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.0/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 499, in main
    return command_table[parsed_args.command](remaining, parsed_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.0/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 634, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.0/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 837, in __call__
    return self._operation_caller.invoke(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.0/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 963, in invoke
    response = self._make_client_call(
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.0/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 975, in _make_client_call
    response = getattr(client, xform_name(operation_name))(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.0/libexec/lib/python3.11/site-packages/awscli/botocore/client.py", line 360, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.0/libexec/lib/python3.11/site-packages/awscli/botocore/client.py", line 701, in _make_api_call
    request_dict = self._convert_to_request_dict(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.0/libexec/lib/python3.11/site-packages/awscli/botocore/client.py", line 764, in _convert_to_request_dict
    request_dict = self._serializer.serialize_to_request(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.0/libexec/lib/python3.11/site-packages/awscli/botocore/validate.py", line 336, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter TagSpecifications[0].Tags[0], value: Key=Name, type: <class 'str'>, valid types: <class 'dict'>
Invalid type for parameter TagSpecifications[1].Tags[0], value: Value=my-ipv4-only-subnet, type: <class 'str'>, valid types: <class 'dict'>

Parameter validation failed:
Invalid type for parameter TagSpecifications[0].Tags[0], value: Key=Name, type: <class 'str'>, valid types: <class 'dict'>
Invalid type for parameter TagSpecifications[1].Tags[0], value: Value=my-ipv4-only-subnet, type: <class 'str'>, valid types: <class 'dict'>
# aws-cli/2.15.58 Python/3.11.8 Linux/6.1.90-99.173.amzn2023.x86_64 exec-env/CloudShell exe/x86_64.amzn.2023
aws ec2 create-subnet --vpc-id vpc-0d54e6a6aee42292c --cidr-block 10.21.16.0/20 --tag-specifications ResourceType=subnet,Tags=[{Key=Name,Value=my-ipv4-only-subnet}] --debug
...
2024-06-04 21:10:42,297 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "awscli/clidriver.py", line 499, in main
  File "awscli/clidriver.py", line 634, in __call__
  File "awscli/clidriver.py", line 837, in __call__
  File "awscli/clidriver.py", line 963, in invoke
  File "awscli/clidriver.py", line 975, in _make_client_call
  File "awscli/botocore/client.py", line 360, in _api_call
  File "awscli/botocore/client.py", line 701, in _make_api_call
  File "awscli/botocore/client.py", line 764, in _convert_to_request_dict
  File "awscli/botocore/validate.py", line 336, in serialize_to_request
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter TagSpecifications[0].Tags[0], value: Key=Name, type: <class 'str'>, valid types: <class 'dict'>
Invalid type for parameter TagSpecifications[1].Tags[0], value: Value=my-ipv4-only-subnet, type: <class 'str'>, valid types: <class 'dict'>

Parameter validation failed:
Invalid type for parameter TagSpecifications[0].Tags[0], value: Key=Name, type: <class 'str'>, valid types: <class 'dict'>
Invalid type for parameter TagSpecifications[1].Tags[0], value: Value=my-ipv4-only-subnet, type: <class 'str'>, valid types: <class 'dict'>

Fully double quoting the argument to tag-specifications results in a successful invocation on both platforms.

Full debug log from MacOS is attached.
debug-log-macos.txt

Possible Solution

No response

Additional Information/Context

No response

CLI version used

Multiple (see repro)

Environment details (OS name and version, etc.)

Multiple (see repro)

@corey-cole corey-cole added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 4, 2024
@tim-finnigan tim-finnigan self-assigned this Jun 4, 2024
@tim-finnigan
Copy link
Contributor

tim-finnigan commented Jun 4, 2024

Thanks for reporting. Regarding the issue you referenced (#8211) it looks like the example in the create-snapshots documentation has since been fixed to include quotes:

image

However there are not quotes in the example documented for create-subnet:

image

@tim-finnigan tim-finnigan added investigating This issue is being investigated and/or work is in progress to resolve the issue. documentation This is a problem with documentation. ec2 p2 This is a standard priority issue and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels Jun 4, 2024
@tim-finnigan tim-finnigan removed their assignment Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. documentation This is a problem with documentation. ec2 p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants