6

I'm trying to pass multiple capabilities to sam deploy

sam deploy --guided --capabilities "CAPABILITY_IAM CAPABILITY_AUTO_EXPAND"

I have tried different forms of this, essentially encoding the list as an array with "[CAPABILITY_IAM, CAPABILITY_AUTO_EXPAND]", and makeing them strings "[\"CAPABILITY_IAM\", \"CAPABILITY_AUTO_EXPAND\"]"

Every time it gets to the listed capablities in the process, the only thing that is listed is CAPABILITY_IAM

The documentation says that --capabilities takes a list. What does a list of capabilities look like?

Josh Russo
  • 3,080
  • 2
  • 41
  • 62
  • Have you tried `sam deploy --guided --capabilities "CAPABILITY_IAM, CAPABILITY_AUTO_EXPAND"` already? – Dunedan Apr 15 '20 at 15:52
  • @Dunedan I have now, no dice – Josh Russo Apr 15 '20 at 15:59
  • I am able to get multiple capablities to work via the `samconfig.toml` with the line `capabilities = "CAPABILITY_IAM CAPABILITY_AUTO_EXPAND"` but I can't find the correct syntax for the command line switch – Josh Russo Apr 15 '20 at 16:01

2 Answers2

12

While it's all but obvious, what you have to do is to provide the capabilities unquoted like this:

sam deploy --guided --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND

The same applies to providing multiple values for --notification-arns and --tags as well.

I'm not sure why the AWS SAM CLI developers decided to implement it this way, but they expect a whitespace-separated list of values for these parameters.

Dunedan
  • 7,848
  • 6
  • 42
  • 52
  • That's still not picking up the auto expand capability. If I choose 'n' for `Allow SAM CLI IAM role creation [Y/n]:` the listed capabilities are `Capabilities : ["CAPABILITY_IAM"]`. If I choose 'Y' the next step always looks like `Capabilities [['CAPABILITY_IAM']]:`, and it ends up with the same capabilities listed. – Josh Russo Apr 15 '20 at 20:10
  • Did you try running it without `--guided`? When I did that the summary showed me both capabilities. – Dunedan Apr 16 '20 at 05:20
  • If I'm not going to use `--guided` then I can just set it in the `samconfig.toml`. This seems like a bug with the guided functionality – Josh Russo Apr 16 '20 at 15:00
-1

Either of following should work :

sam deploy --guided --capabilities=['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM']

sam deploy --guided --capabilities=["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"]