Starter for AWS Infrastructure as Code with SAM and Terraform
- Install and configure AWS SAM CLI
- Install Terraform CLI
Use example.secrets.tfvars and example.tfvars.json to store sensitive config.
When using in production it MUST be kept SECRET !
Please copy-paste content in new files dev.secrets.tfvars and dev.tfvars.json to use them.
cd <Example of your choice>terraform initonly the first time- create 'dev' workspace:
terraform workspace new dev - use 'dev' workspace:
terraform workspace select dev - list workspaces:
terraform workspace list terraform validateterraform plan -var-file="dev.secrets.tfvars.json" -out="out.plan"- Or if multiple var files:
terraform plan -var-file="dev.secrets.tfvars.json" -var-file="dev.config.tfvars.json" -out="out.plan" terraform apply out.planterraform destroy -var-file="dev.secrets.tfvars.json"
cd <Example of your choice>sam validate -t aws-stack.ymlsam deploy -t aws-stack.yml -gsam deleteorsam delete --stack-name sam-app