aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.53k stars 1.17k forks source link

SAM TOML file should support array of capabilities #1899

Closed drumadrian closed 1 year ago

drumadrian commented 4 years ago

Describe your idea/feature/enhancement:

The samconfig.toml file allows specifying capabilities like this:

capabilities = "CAPABILITY_IAM"

This documentation page explains that SAM uses TOML: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html

Proposal:

The TOML documentation shows that TOML arrays are expressed like this:

integers = [ 1, 2, 3 ]
colors = [ "red", "yellow", "green" ]
nested_array_of_int = [ [ 1, 2 ], [3, 4, 5] ]
nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
string_array = [ "all", 'strings', """are the same""", '''type''' ]

# Mixed-type arrays are allowed
numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
contributors = [
  "Foo Bar <foo@example.com>",
  { name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" }
]

The SAM TOML file should allow this as a valid expression of multiple capabilities:

capabilities = [ "CAPABILITY_IAM", "CAPABILITY_AUTO_EXPAND" ]

Additional Details:

  1. Will this require any updates to the SAM Spec?
    • I do not believe this will require updates to the SAM Spec.

Thank you for considering this feature

sriram-mv commented 4 years ago

Thanks for the feature request. you should be able to have multiple values in your samconfig.toml file this way right now, but i have tagged this issue as feature request. 👍

version = 0.1
[default]
[default.deploy]
[default.deploy.parameters]
capabilities = "CAPABILITY_IAM CAPABILITY_NAMED_IAM"
drumadrian commented 4 years ago

Thank you @sriram-mv

I was able to use that approach to have multiple values in my samconfig.toml file

Screenshot:

successful multiple capabilities
matheuscanela commented 4 years ago

Hi sriram-mv@

I added a PR for the documentation as it is not clear; however, I would recommend updating the documentation once this feature is released.

aahung commented 3 years ago

Also there seems to be no way to specify multiple capacities using cli args.

qingchm commented 2 years ago

I think changing the default option behaviour would be a breaking change for many so instead of a feature request I think this should be a UX change request. Multiple values for capabilities for both toml and cli arg are realized by having a long string with values separated by space like: capabilities = "CAPABILITY_IAM CAPABILITY_NAMED_IAM". I think this is still a relevant request since the doc and the help text doesn't mention this.

drumadrian commented 2 years ago

Hi @qingchm,

That sounds good. I hope we can find a way to implement this change without breaking anyone's code.

Maybe a warning from the CLI could help.

Thanks for looking into this 🤓

qingchm commented 2 years ago

My pleasure!

sriram-mv commented 1 year ago
[default.deploy]
[default.deploy.parameters]
capabilities = ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"]
resolve_s3 = true

On further investigation, above seems to work. Is this something that you are still running into?

drumadrian commented 1 year ago

Hey @sriram-mv 🤓

This request has been open for a while so I think the context of my original request is expired.

I don't use the Serverless Application Model (SAM) anymore, so can't say if this is still an issue. I was able to use your help in May 2022 to specify multiple values so I updated this request and finished my project.

I think the request can be closed if all possible valid expressions of multiple capabilities are working:

For example:

capabilities = [ "CAPABILITY_IAM", "CAPABILITY_AUTO_EXPAND" ]

Also, @qingchm discovered the risk of a breaking change to address this issue. @qingchm may have some good input on the current risks with this type of change.

Thank you for helping with this request. I sincerely appreciate that Amazonians try their best to follow up on customer requests. Let me know if you need anything else. I don't mind jumping on a Chime call.

Take care,

Adrian

jfuss commented 1 year ago

@drumadrian Trying to parse through some of our older issues. I think this was solved in https://github.com/aws/aws-sam-cli/commit/164747650d6b2c776d5a94032e74f09ca17393a7 (looking at the tests) but trying to verify that.

Thanks for submitting it the initial request!

jfuss commented 1 year ago

Checked with the team! Yes, we can finally close this one out!

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.