Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add version attr to third-party modules #4

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion 2-modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ In the first lab, we bootstrapped Terraform and got familiar with the very basic

module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
version = "3.2.0"

function_name = "hello-world"
handler = "helloworld.handler"
Expand All @@ -75,6 +76,8 @@ The good part is, that we can write our own modules or use third-party modules.

The Terraform community is very vibrant and you can find thousands of modules. Before reinventing the wheel, check out the [Terraform Registry](https://registry.terraform.io).

For third-party modules, it's [good practice](https://www.terraform.io/language/expressions/version-constraints#module-versions) to add the version attribute and define a specific version. That ensures you don't accidentally upgrade third-party modules.

That's it for the Lambda function. Let's go to the API Gateway.

## API Gateway
Expand Down Expand Up @@ -118,7 +121,8 @@ That's it for the Lambda function. Let's go to the API Gateway.
}

module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
source = "terraform-aws-modules/lambda/aws"
version = "3.2.0"

function_name = "hello-world"
handler = "helloworld.handler"
Expand Down
3 changes: 2 additions & 1 deletion 2-modules/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ resource "aws_s3_bucket_website_configuration" "website" {
}

module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
source = "terraform-aws-modules/lambda/aws"
version = "3.2.0"

function_name = "hello-world"
handler = "helloworld.handler"
Expand Down
3 changes: 2 additions & 1 deletion 3-composition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ The previous lab introduced a third-party module to easily deploy a Lambda funct
}

module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
source = "terraform-aws-modules/lambda/aws"
version = "3.2.0"

function_name = "${local.project_name}-${var.environment}"
handler = "helloworld.handler"
Expand Down
3 changes: 2 additions & 1 deletion 3-composition/modules/api/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ locals {
}

module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
source = "terraform-aws-modules/lambda/aws"
version = "3.2.0"

function_name = "${local.project_name}-${var.environment}"
handler = "helloworld.handler"
Expand Down
3 changes: 2 additions & 1 deletion 4-parameterization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ The API becomes more powerful in this lab, but we want to be careful and only ro
}

module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
source = "terraform-aws-modules/lambda/aws"
version = "3.2.0"

function_name = "${local.project_name}-${var.environment}"
handler = "helloworld.handler"
Expand Down
1 change: 1 addition & 0 deletions 4-parameterization/modules/api/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ locals {

module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
version = "3.2.0"

function_name = "${local.project_name}-${var.environment}"
handler = "helloworld.handler"
Expand Down