Reputation: 81
Working through a deployment on a stack using AWS SAM and deploying via GitHub actions and was trying to use the Config TOML file and specifying a config environment in the deploy command and I am running into the issue where it seems to be just ignoring what I am specifying in the deployment command. Only thing I can only guess I am doing wrong is that I cannot actually use these or that I have it in the wrong location but I would greatly appreciate any help on the matter. Not finding much out there in terms of similar examples or documentation.
sam deploy \
--stack-name mySuperAwesomeStuff \
--region ${{ secrets.AWS_REGION }} \
--confirm-changeset \
--config-file ./functions/function1/function1.toml \
--config-env nonprod \
--template-file ./functions/function1/template.yaml
Ideally, I would love to get the region out of there and into the TOML file as well as the stackname.
My TOML file looks like this:
[nonprod.deploy.parameters]
stack_name="super-awesome-stack-name"
region="us-east-2"
confirm_changeset=true
cababilities="CABILITIES_IAM"
Once again, just seems to be completely ignoring me trying to use the config-file and I am not sure what I am missing here.
Upvotes: 8
Views: 20185
Reputation: 1645
What worked for me was specifying the full path to the samconfig.toml
(instead of the relative path).
sam deploy \
--config-file <ABSOLUTE_PATH_TO_CONFIG_FILE> \
--template-file <RELATIVE_OR_ABSOLUTE_PATH_TO_TEMPLATE_FILE>
And my config file (samconfig.toml
):
version = 0.1
[default.deploy.parameters]
stack_name = "xxx"
s3_bucket = "xxx"
s3_prefix = "xxx"
region = "xxx"
confirm_changeset = false
capabilities = "CAPABILITY_IAM"
image_repositories = []
Upvotes: 1
Reputation: 166
My samconfig.toml
also has a version at the top, like
version = 0.1
[nonprod.deploy.parameters]
region = "us-east-2"
I suspect this is the problem with --config-file
attribute. I would suggest to rename the config to samconfig.toml
and place it on the root, where you are running sam deploy
to pinpoint the problem with --config-file
.
Also, I found this which says that, --config-file
is not implemented yet: https://github.com/aws/aws-sam-cli/blob/develop/designs/sam-config.md#not-implemented
PS: I have my samconfig.toml
on the root where I run sam deploy
and it works like a charm.
Upvotes: 1
Reputation: 81
Please check if you have added this header [nonprod.deploy]
and then the parameters:
[nonprod.deploy]
[nonprod.deploy.parameters]
stack_name="super-awesome-stack-name"
region="us-east-2"
confirm_changeset=true
cababilities="CABILITIES_IAM"
Upvotes: 0
Reputation: 51
It's a bit confusing at first, but you should know that the samconfig.toml
file is being read when doing sam deploy
, the key thing you're missing is the environment
that you want to deploy. In your case, you have named it nonprod
(based on this line [nonprod.deploy.parameters]
). The command you should be running for deployment should now be sam deploy --stack-name super-awesome-stack-name --config-env nonprod
.
Upvotes: 5