aws / chalice

Python Serverless Microframework for AWS
Apache License 2.0
10.67k stars 1.01k forks source link

Use config.json with chalice package #925

Open rapidoo opened 6 years ago

rapidoo commented 6 years ago

I want to deploy my package with chalice package in order to use CloudFormation https://chalice.readthedocs.io/en/latest/topics/cfn.html?highlight=package

it seem that the job don't use my config.json to use the arn role I expect

"manage_iam_role" : false, "iam_role_arn" : "arn:aws:iam:*****

because sam.json is generated with an DefaultRolePolicy

cmd : chalice package ./tmp2 --stage prod

config.json : { "version": "2.0", "app_name": "XXXXXXX", "stages": { "dev": { "api_gateway_stage": "api", "lambda_timeout": 120, "lambda_memory_size": 1024, "manage_iam_role" : false, "iam_role_arn" : "arn:aws:iam::*****:role/lambda_dynamodb_s3" }}, "prod": { "api_gateway_stage": "api", "lambda_timeout": 120, "lambda_memory_size": 1024, "manage_iam_role" : false, "iam_role_arn" : "arn:aws:iam::**:role/lambda_dynamodb_s3" } }

gallmerci commented 6 years ago

To prevent the generation of the default role use autogen_policy config. But are you sure that the generated role is used for your API handler in the sam file and not your specified role?

rapidoo commented 6 years ago

Thanks, but in fact chalice is right and my config false :(

}}, "prod": {

the prod item is not in stages !!

The point is chalice could display an error when dealing with an unkown stage