Deploy lambda functions using Terraform.
Regions are defined by current workspace, and by default, they are configured on variables file.
Has been created a simple Python function for this example.
Define the profile access on ~/.aws/credentials
, ex.:
[lambidas]
aws_access_key_id = <KEY>
aws_secret_access_key = <ACCESS-KEY>
Initialize the working directory. Install project dependencies.
$ terraform init
Workspaces enable apply same configurations in differents cenarios like production, homologation, development.
View a list of availables workspaces
$ terrafor workspace list
Create a new workspace
$ terraform workspace new <workspace-name>
Use terraform.workspace
on code to get current workspace
Validates the Terraform files before
$ terraform validate
Generate and show an execution plan
$ terraform plan
Builds or changes infrastructure. Persist current state changes to local and remote storage
$ terraform apply -auto-approve
Destroy created managed infrastructure
$ terraform destroy -auto-approve