diff --git a/_docs-sources/iac/getting-started/accessing-the-code.md b/_docs-sources/iac/getting-started/accessing-the-code.md index a8fbdc23c5..eecdb8862f 100644 --- a/_docs-sources/iac/getting-started/accessing-the-code.md +++ b/_docs-sources/iac/getting-started/accessing-the-code.md @@ -1,9 +1,9 @@ # Accessing the code -Gruntwork provides all code included in your subscription to the Infrastructure as Code (IaC) library through GitHub. To gain access to the IaC Library, you must first [create an account in the Developer Portal](../../developer-portal/create-account.md). Once you have an account, you must [link your Github ID](../../developer-portal/link-github-id) to your Developer Portal account to gain access to the IaC Library. +Gruntwork provides all code included in your subscription to the Infrastructure as Code (IaC) library through GitHub. To gain access to the IaC Library, you must first [create an account in the Developer Portal](../../developer-portal/create-account.md). Once you have an account, you must [link your GitHub ID](../../developer-portal/link-github-id) to your Developer Portal account to gain access to the IaC Library. ## Accessing Modules and Services in the IaC library -Once you have gained access to the Gruntwork IaC library, you can view the source code for our modules and services in [Github](https://github.com/orgs/gruntwork-io/repositories). For a full list of modules and services, check the [Library Reference](../../iac/reference/index.md). +Once you have gained access to the Gruntwork IaC library, you can view the source code for our modules and services in [GitHub](https://github.com/orgs/gruntwork-io/repositories). For a full list of modules and services, check the [Library Reference](../../iac/reference/index.md). -In Github, each IaC repository is prefixed with `terraform-aws-` then a high level description of the modules it contains. For example, Amazon SNS, SQS, MSK, and Kinesis are located in the `terraform-aws-messaging` repository. In each repository, the modules are located in the `modules` directory. Example usage and tests are provided for each module in the `examples` and `tests` directories, respectively. +In GitHub, each IaC repository is prefixed with `terraform-aws-` then a high level description of the modules it contains. For example, Amazon SNS, SQS, MSK, and Kinesis are located in the `terraform-aws-messaging` repository. In each repository, the modules are located in the `modules` directory. Example usage and tests are provided for each module in the `examples` and `tests` directories, respectively. diff --git a/_docs-sources/iac/getting-started/deploying-a-module.md b/_docs-sources/iac/getting-started/deploying-a-module.md index 41db109899..9ed81cada7 100644 --- a/_docs-sources/iac/getting-started/deploying-a-module.md +++ b/_docs-sources/iac/getting-started/deploying-a-module.md @@ -2,8 +2,6 @@ [Modules](../overview/modules.md) allow you to define an interface to create one or many resources in the cloud or on-premise, similar to how in object oriented programming you can define a class that may have different attribute values across many instances. -Modules help keep your Terraform code DRY (Don’t Repeat Yourself), and speed up development time when creating new resources. - This tutorial will teach you how to develop a Terraform module that deploys an AWS Lambda function. We will create the required file structure, define an AWS Lambda function and AWS IAM role as code, then plan and apply the resource in an AWS account. Then, we’ll verify the deployment by invoking the Lambda using the AWS CLI. Finally, we'll clean up the resources we create to avoid unexpected costs. ## Prerequisites @@ -22,7 +20,7 @@ This module could be referenced many times to create any number of AWS Lambda fu ### Create a basic file structure First, create the directories and files that will contain the Terraform configuration. -```sh +```bash mkdir -p terraform-aws-gw-lambda-tutorial/modules/lambda touch terraform-aws-gw-lambda-tutorial/modules/lambda/main.tf touch terraform-aws-gw-lambda-tutorial/modules/lambda/variables.tf @@ -34,7 +32,7 @@ touch terraform-aws-gw-lambda-tutorial/modules/lambda/outputs.tf First, define the resources that should be created by the module. This is where you define resource level blocks provided by Terraform. For this module, we need an AWS Lambda function and an IAM role that will be used by the Lambda function. Paste the following snippet in `terraform-aws-gw-lambda/modules/lambda/main.tf`. -```hcl +```hcl title="terraform-aws-gw-lambda/modules/lambda/main.tf" resource "aws_iam_role" "lambda_role" { name = "${var.lambda_name}-role" @@ -80,7 +78,7 @@ Now that you’ve defined the resources you want to create, you need to list out Copy the following snippet into `terraform-aws-gw-lambda-tutorial/modules/lambda/variables.tf`. -```tf +```hcl title="terraform-aws-gw-lambda-tutorial/modules/lambda/variables.tf" variable "lambda_name" { type = string description = "Name that will be used for the AWS Lambda function" @@ -119,7 +117,7 @@ variable "timeout" { Terraform allows you to specify values that the module will output. Outputs are convenient ways to pass values between modules when composing a service comprised of many modules. Copy the following snippet into `terraform-aws-gw-lambda-tutorial/modules/lambda/outputs.tf`. -```tf +```hcl title="terraform-aws-gw-lambda-tutorial/modules/lambda/outputs.tf" output "function_name" { value = aws_lambda_function.lambda.function_name } @@ -134,7 +132,7 @@ Now that you have defined a module that creates an AWS Lambda function and IAM r Now that you have the module defined, you need to create files which will reference the module. Typically, you would create a module in one repository, then reference it in a different repository. For this tutorial, we’ll just create the reference in the top level directory for the sake of simplicity. Create a file called `main.tf`, which will contain a reference to the module, and a file called `main.py`, which will contain the Lambda function code. -```sh +```bash touch terraform-aws-gw-lambda-tutorial/main.tf touch terraform-aws-gw-lambda-tutorial/main.py ``` @@ -144,7 +142,8 @@ touch terraform-aws-gw-lambda-tutorial/main.py Next, we’ll write a simple Python function that returns a string that will be used as the entrypoint of the AWS Lambda function. Terraform will create a zip file containing this file that will be uploaded to the Lambda function. Copy the following to `terraform-aws-gw-lambda-tutorial/main.py`. -``` + +```py title="terraform-aws-gw-lambda-tutorial/main.py" def lambda_handler(event, context): return "Hello from Gruntwork!" ``` @@ -153,7 +152,7 @@ def lambda_handler(event, context): Next, create a reference to the module you just created in `/modules/lambda/main.tf`. This code uses the `module` block from Terraform, which references the `/modules/lambda` directory using the `source` attribute. You can then specify values for the required variables specified in `/modules/lambdas/variables.tf`. Finally, we specify an output using the value of the `module.lambda.function_name` output created in `/modules/lambdas/outputs.tf` -``` +```hcl title="terraform-aws-gw-lambda-tutorial/main.tf" terraform { required_providers { aws = { @@ -188,11 +187,11 @@ Running `terraform plan` is helpful when developing modules, to confirm that the From the `terraform-aws-gw-lambda-tutorial` directory, run a plan to see what resources will be created. -```sh +```bash terraform plan ``` -Review the output of `terraform plan`, it should contain two resources - an AWS Lambda function and an AWS IAM role. +Review the output of `terraform plan`, it should contain two resources — an AWS Lambda function and an AWS IAM role. ### Run Terraform apply @@ -201,7 +200,7 @@ Terraform creates resources when using the `apply` action in a directory contain From the `terraform-aws-gw-lambda-tutorial` directory, run `terraform apply`. Terraform will pause to show you the resources it will create and prompt you to confirm resource creation. -```sh +```bash terraform apply ``` @@ -212,14 +211,14 @@ Review the output to confirm it will only create an AWS Lambda function and IAM Next, invoke the AWS Lambda function to verify it was created and is successfully executing the application code. Use `terraform output` to retrieve the name of the AWS Lambda function you provisioned. This uses the outputs we added to the module in [create a module](./deploying-a-module.md#create-a-module) to retrieve the name of the Lambda function. Then, invoke the Lambda function directly using the AWS CLI, writing the response of the Lambda to a file called `lambda_output`. -```sh +```bash #!/bin/bash export FUNCTION_NAME=$(terraform output -raw function_name) aws lambda invoke --function-name $FUNCTION_NAME --output json lambda_output ``` The lambda `invoke` command should return a JSON blob in response with the StatusCode of 200 and the ExecutedVersion of `$LATEST`. -```sh +```json { "StatusCode": 200, "ExecutedVersion": "$LATEST" @@ -233,7 +232,7 @@ Inspect the contents of the `lambda_output` file, you should see a string statin When you’ve completed the tutorial, clean up the resources you created to avoid incurring unexpected costs. First, execute the `terraform plan -destroy` command to show the AWS resources that will be destroyed. -```sh +```bash terraform plan -destroy ``` @@ -241,7 +240,7 @@ Review the output, it should show two resources to be destroyed — an AWS Lambd Next, execute the `destroy` command. -```sh +```bash terraform destroy ``` diff --git a/_docs-sources/iac/getting-started/setting-up.md b/_docs-sources/iac/getting-started/setting-up.md index 6cf61a7c5b..4f22ca88ed 100644 --- a/_docs-sources/iac/getting-started/setting-up.md +++ b/_docs-sources/iac/getting-started/setting-up.md @@ -20,9 +20,11 @@ If you want to skip immediately to learning, you can learn how to [deploy your f ## Terragrunt -Terragrunt is a tool developed by Gruntwork that provides extra tools for keeping your Terraform configurations DRY, working with multiple Terraform modules, and managing remote state. Terragrunt allows you to execute multiple Terraform commands at once, centrally manage your Terraform state configuration, and set repeatable CLI arguments. Since Terraform is a dependency of Terragrunt, you can continue to write modules for Terraform in the Terraform configuration language, then reference and re-use the modules in different environments or applications. +[Terragrunt](https://terragrunt.gruntwork.io) is a tool developed by Gruntwork that provides extra tools for keeping your Terraform configurations DRY, working with multiple Terraform modules, and managing remote state. Terragrunt allows you to execute multiple Terraform commands at once, centrally manage your Terraform state configuration, and set repeatable CLI arguments. Since Terraform is a dependency of Terragrunt, you can continue to write modules for Terraform in the Terraform configuration language, then reference and re-use the modules in different environments or applications. +:::info Terragrunt is not a required tool to use the IaC library, but it does provide many convenience features on top of Terraform. If you are using the Gruntwork [Reference Architecture](../../refarch/whats-this/what-is-a-reference-architecture), Terragrunt is a requirement. +::: ### Installation Terragrunt is supported on Mac (x86 and Apple Silicon), Windows, and Linux. To install Terragrunt, follow the guide on how to [install Terragrunt](https://terragrunt.gruntwork.io/docs/getting-started/install/) on the Terragrunt website. diff --git a/_docs-sources/iac/stay-up-to-date/updating.md b/_docs-sources/iac/stay-up-to-date/updating.md index a356637dac..28299fbe22 100644 --- a/_docs-sources/iac/stay-up-to-date/updating.md +++ b/_docs-sources/iac/stay-up-to-date/updating.md @@ -10,7 +10,7 @@ Below is a module block referencing version `0.15.3` of the `single-server` subm To update to version `0.15.4`, you update the value to the right of `ref=` in the source attribute. Since the version number denotes that this update is backwards compatible, it should not require any other changes. -```tf +```hcl module "my_instance" { # Old # source = "git::git@github.com:gruntwork-io/terraform-aws-server.git//modules/single-server?ref=v0.15.3" diff --git a/_docs-sources/iac/stay-up-to-date/versioning.md b/_docs-sources/iac/stay-up-to-date/versioning.md index 423ecf3cc8..35601ca3b3 100644 --- a/_docs-sources/iac/stay-up-to-date/versioning.md +++ b/_docs-sources/iac/stay-up-to-date/versioning.md @@ -5,7 +5,9 @@ Gruntwork versions the IaC library using [Semantic Versioning](https://semver.or - MINOR version when we make backward incompatible API changes, and - PATCH version when we add backward compatible functionality or bug fixes -For modules that have submodules (e.g., terraform-aws-server/modules/single-server), not every release contains changes to every module. While using the latest available version is recommended, the version that most recently contains changes for a module can be found in each submodule's reference in the [Library Reference](../reference/index.md). +For modules that have submodules (e.g., terraform-aws-server/modules/single-server), not every release contains changes to every module. While using the latest available version is recommended, the version that most recently contains changes for a module can be found in each submodule’s reference in the [Library Reference](../reference/index.md). + +![Submodules show the last version in which they were modified](/img/iac/stay-up-to-date/versioning/module_release_tag_versions.png) We release new module versions using GitHub releases, refer to the release notes in the GitHub repository release page for a list of changes and migration guides (when necessary). @@ -14,7 +16,7 @@ We release new module versions using GitHub releases, refer to the release notes The git tag created by the release can then be referenced in the source argument for a module block sourcing from a git URL. For example, below is a module block referencing version `0.15.4` of the `single-server` submodule from the `terraform-aws-server` module. -```tf +```hcl module "my_instance" { source = "git::git@github.com:gruntwork-io/terraform-aws-server.git//modules/single-server?ref=v0.15.4" @@ -29,6 +31,6 @@ module "my_instance" { } ``` -## What's next +## What’s next -Once you start using versioned modules, it's important to keep the modules up to date. Refer to the [Updating](./updating.md) guide to learn more. +Once you start using versioned modules, it’s important to keep the modules up to date. Refer to the [Updating](./updating.md) guide to learn more. diff --git a/docs/iac/getting-started/accessing-the-code.md b/docs/iac/getting-started/accessing-the-code.md index 380859cc4b..1ba5be8b6f 100644 --- a/docs/iac/getting-started/accessing-the-code.md +++ b/docs/iac/getting-started/accessing-the-code.md @@ -1,17 +1,17 @@ # Accessing the code -Gruntwork provides all code included in your subscription to the Infrastructure as Code (IaC) library through GitHub. To gain access to the IaC Library, you must first [create an account in the Developer Portal](../../developer-portal/create-account.md). Once you have an account, you must [link your Github ID](../../developer-portal/link-github-id) to your Developer Portal account to gain access to the IaC Library. +Gruntwork provides all code included in your subscription to the Infrastructure as Code (IaC) library through GitHub. To gain access to the IaC Library, you must first [create an account in the Developer Portal](../../developer-portal/create-account.md). Once you have an account, you must [link your GitHub ID](../../developer-portal/link-github-id) to your Developer Portal account to gain access to the IaC Library. ## Accessing Modules and Services in the IaC library -Once you have gained access to the Gruntwork IaC library, you can view the source code for our modules and services in [Github](https://github.com/orgs/gruntwork-io/repositories). For a full list of modules and services, check the [Library Reference](../../iac/reference/index.md). +Once you have gained access to the Gruntwork IaC library, you can view the source code for our modules and services in [GitHub](https://github.com/orgs/gruntwork-io/repositories). For a full list of modules and services, check the [Library Reference](../../iac/reference/index.md). -In Github, each IaC repository is prefixed with `terraform-aws-` then a high level description of the modules it contains. For example, Amazon SNS, SQS, MSK, and Kinesis are located in the `terraform-aws-messaging` repository. In each repository, the modules are located in the `modules` directory. Example usage and tests are provided for each module in the `examples` and `tests` directories, respectively. +In GitHub, each IaC repository is prefixed with `terraform-aws-` then a high level description of the modules it contains. For example, Amazon SNS, SQS, MSK, and Kinesis are located in the `terraform-aws-messaging` repository. In each repository, the modules are located in the `modules` directory. Example usage and tests are provided for each module in the `examples` and `tests` directories, respectively. diff --git a/docs/iac/getting-started/deploying-a-module.md b/docs/iac/getting-started/deploying-a-module.md index 7cd856602a..a8610ec3d1 100644 --- a/docs/iac/getting-started/deploying-a-module.md +++ b/docs/iac/getting-started/deploying-a-module.md @@ -2,8 +2,6 @@ [Modules](../overview/modules.md) allow you to define an interface to create one or many resources in the cloud or on-premise, similar to how in object oriented programming you can define a class that may have different attribute values across many instances. -Modules help keep your Terraform code DRY (Don’t Repeat Yourself), and speed up development time when creating new resources. - This tutorial will teach you how to develop a Terraform module that deploys an AWS Lambda function. We will create the required file structure, define an AWS Lambda function and AWS IAM role as code, then plan and apply the resource in an AWS account. Then, we’ll verify the deployment by invoking the Lambda using the AWS CLI. Finally, we'll clean up the resources we create to avoid unexpected costs. ## Prerequisites @@ -22,7 +20,7 @@ This module could be referenced many times to create any number of AWS Lambda fu ### Create a basic file structure First, create the directories and files that will contain the Terraform configuration. -```sh +```bash mkdir -p terraform-aws-gw-lambda-tutorial/modules/lambda touch terraform-aws-gw-lambda-tutorial/modules/lambda/main.tf touch terraform-aws-gw-lambda-tutorial/modules/lambda/variables.tf @@ -34,7 +32,7 @@ touch terraform-aws-gw-lambda-tutorial/modules/lambda/outputs.tf First, define the resources that should be created by the module. This is where you define resource level blocks provided by Terraform. For this module, we need an AWS Lambda function and an IAM role that will be used by the Lambda function. Paste the following snippet in `terraform-aws-gw-lambda/modules/lambda/main.tf`. -```hcl +```hcl title="terraform-aws-gw-lambda/modules/lambda/main.tf" resource "aws_iam_role" "lambda_role" { name = "${var.lambda_name}-role" @@ -80,7 +78,7 @@ Now that you’ve defined the resources you want to create, you need to list out Copy the following snippet into `terraform-aws-gw-lambda-tutorial/modules/lambda/variables.tf`. -```tf +```hcl title="terraform-aws-gw-lambda-tutorial/modules/lambda/variables.tf" variable "lambda_name" { type = string description = "Name that will be used for the AWS Lambda function" @@ -119,7 +117,7 @@ variable "timeout" { Terraform allows you to specify values that the module will output. Outputs are convenient ways to pass values between modules when composing a service comprised of many modules. Copy the following snippet into `terraform-aws-gw-lambda-tutorial/modules/lambda/outputs.tf`. -```tf +```hcl title="terraform-aws-gw-lambda-tutorial/modules/lambda/outputs.tf" output "function_name" { value = aws_lambda_function.lambda.function_name } @@ -134,7 +132,7 @@ Now that you have defined a module that creates an AWS Lambda function and IAM r Now that you have the module defined, you need to create files which will reference the module. Typically, you would create a module in one repository, then reference it in a different repository. For this tutorial, we’ll just create the reference in the top level directory for the sake of simplicity. Create a file called `main.tf`, which will contain a reference to the module, and a file called `main.py`, which will contain the Lambda function code. -```sh +```bash touch terraform-aws-gw-lambda-tutorial/main.tf touch terraform-aws-gw-lambda-tutorial/main.py ``` @@ -144,7 +142,8 @@ touch terraform-aws-gw-lambda-tutorial/main.py Next, we’ll write a simple Python function that returns a string that will be used as the entrypoint of the AWS Lambda function. Terraform will create a zip file containing this file that will be uploaded to the Lambda function. Copy the following to `terraform-aws-gw-lambda-tutorial/main.py`. -``` + +```py title="terraform-aws-gw-lambda-tutorial/main.py" def lambda_handler(event, context): return "Hello from Gruntwork!" ``` @@ -153,7 +152,7 @@ def lambda_handler(event, context): Next, create a reference to the module you just created in `/modules/lambda/main.tf`. This code uses the `module` block from Terraform, which references the `/modules/lambda` directory using the `source` attribute. You can then specify values for the required variables specified in `/modules/lambdas/variables.tf`. Finally, we specify an output using the value of the `module.lambda.function_name` output created in `/modules/lambdas/outputs.tf` -``` +```hcl title="terraform-aws-gw-lambda-tutorial/main.tf" terraform { required_providers { aws = { @@ -188,11 +187,11 @@ Running `terraform plan` is helpful when developing modules, to confirm that the From the `terraform-aws-gw-lambda-tutorial` directory, run a plan to see what resources will be created. -```sh +```bash terraform plan ``` -Review the output of `terraform plan`, it should contain two resources - an AWS Lambda function and an AWS IAM role. +Review the output of `terraform plan`, it should contain two resources — an AWS Lambda function and an AWS IAM role. ### Run Terraform apply @@ -201,7 +200,7 @@ Terraform creates resources when using the `apply` action in a directory contain From the `terraform-aws-gw-lambda-tutorial` directory, run `terraform apply`. Terraform will pause to show you the resources it will create and prompt you to confirm resource creation. -```sh +```bash terraform apply ``` @@ -212,14 +211,14 @@ Review the output to confirm it will only create an AWS Lambda function and IAM Next, invoke the AWS Lambda function to verify it was created and is successfully executing the application code. Use `terraform output` to retrieve the name of the AWS Lambda function you provisioned. This uses the outputs we added to the module in [create a module](./deploying-a-module.md#create-a-module) to retrieve the name of the Lambda function. Then, invoke the Lambda function directly using the AWS CLI, writing the response of the Lambda to a file called `lambda_output`. -```sh +```bash #!/bin/bash export FUNCTION_NAME=$(terraform output -raw function_name) aws lambda invoke --function-name $FUNCTION_NAME --output json lambda_output ``` The lambda `invoke` command should return a JSON blob in response with the StatusCode of 200 and the ExecutedVersion of `$LATEST`. -```sh +```json { "StatusCode": 200, "ExecutedVersion": "$LATEST" @@ -233,7 +232,7 @@ Inspect the contents of the `lambda_output` file, you should see a string statin When you’ve completed the tutorial, clean up the resources you created to avoid incurring unexpected costs. First, execute the `terraform plan -destroy` command to show the AWS resources that will be destroyed. -```sh +```bash terraform plan -destroy ``` @@ -241,7 +240,7 @@ Review the output, it should show two resources to be destroyed — an AWS Lambd Next, execute the `destroy` command. -```sh +```bash terraform destroy ``` @@ -258,6 +257,6 @@ Finally, consider what other resources you would create to make your modules rea diff --git a/docs/iac/getting-started/setting-up.md b/docs/iac/getting-started/setting-up.md index 1ea95a38e2..4df2aec007 100644 --- a/docs/iac/getting-started/setting-up.md +++ b/docs/iac/getting-started/setting-up.md @@ -20,9 +20,11 @@ If you want to skip immediately to learning, you can learn how to [deploy your f ## Terragrunt -Terragrunt is a tool developed by Gruntwork that provides extra tools for keeping your Terraform configurations DRY, working with multiple Terraform modules, and managing remote state. Terragrunt allows you to execute multiple Terraform commands at once, centrally manage your Terraform state configuration, and set repeatable CLI arguments. Since Terraform is a dependency of Terragrunt, you can continue to write modules for Terraform in the Terraform configuration language, then reference and re-use the modules in different environments or applications. +[Terragrunt](https://terragrunt.gruntwork.io) is a tool developed by Gruntwork that provides extra tools for keeping your Terraform configurations DRY, working with multiple Terraform modules, and managing remote state. Terragrunt allows you to execute multiple Terraform commands at once, centrally manage your Terraform state configuration, and set repeatable CLI arguments. Since Terraform is a dependency of Terragrunt, you can continue to write modules for Terraform in the Terraform configuration language, then reference and re-use the modules in different environments or applications. +:::info Terragrunt is not a required tool to use the IaC library, but it does provide many convenience features on top of Terraform. If you are using the Gruntwork [Reference Architecture](../../refarch/whats-this/what-is-a-reference-architecture), Terragrunt is a requirement. +::: ### Installation Terragrunt is supported on Mac (x86 and Apple Silicon), Windows, and Linux. To install Terragrunt, follow the guide on how to [install Terragrunt](https://terragrunt.gruntwork.io/docs/getting-started/install/) on the Terragrunt website. @@ -42,6 +44,6 @@ If you’re ready to get started with creating and deploying a module, jump to [ diff --git a/docs/iac/stay-up-to-date/updating.md b/docs/iac/stay-up-to-date/updating.md index cefa6bc443..a74745ec52 100644 --- a/docs/iac/stay-up-to-date/updating.md +++ b/docs/iac/stay-up-to-date/updating.md @@ -10,7 +10,7 @@ Below is a module block referencing version `0.15.3` of the `single-server` subm To update to version `0.15.4`, you update the value to the right of `ref=` in the source attribute. Since the version number denotes that this update is backwards compatible, it should not require any other changes. -```tf +```hcl module "my_instance" { # Old # source = "git::git@github.com:gruntwork-io/terraform-aws-server.git//modules/single-server?ref=v0.15.3" @@ -39,6 +39,6 @@ Keeping track of all references to modules and services is a complicated, error diff --git a/docs/iac/stay-up-to-date/versioning.md b/docs/iac/stay-up-to-date/versioning.md index fae7340975..068cbfc8c4 100644 --- a/docs/iac/stay-up-to-date/versioning.md +++ b/docs/iac/stay-up-to-date/versioning.md @@ -5,7 +5,9 @@ Gruntwork versions the IaC library using [Semantic Versioning](https://semver.or - MINOR version when we make backward incompatible API changes, and - PATCH version when we add backward compatible functionality or bug fixes -For modules that have submodules (e.g., terraform-aws-server/modules/single-server), not every release contains changes to every module. While using the latest available version is recommended, the version that most recently contains changes for a module can be found in each submodule's reference in the [Library Reference](../reference/index.md). +For modules that have submodules (e.g., terraform-aws-server/modules/single-server), not every release contains changes to every module. While using the latest available version is recommended, the version that most recently contains changes for a module can be found in each submodule’s reference in the [Library Reference](../reference/index.md). + +![Submodules show the last version in which they were modified](/img/iac/stay-up-to-date/versioning/module_release_tag_versions.png) We release new module versions using GitHub releases, refer to the release notes in the GitHub repository release page for a list of changes and migration guides (when necessary). @@ -14,7 +16,7 @@ We release new module versions using GitHub releases, refer to the release notes The git tag created by the release can then be referenced in the source argument for a module block sourcing from a git URL. For example, below is a module block referencing version `0.15.4` of the `single-server` submodule from the `terraform-aws-server` module. -```tf +```hcl module "my_instance" { source = "git::git@github.com:gruntwork-io/terraform-aws-server.git//modules/single-server?ref=v0.15.4" @@ -29,14 +31,14 @@ module "my_instance" { } ``` -## What's next +## What’s next -Once you start using versioned modules, it's important to keep the modules up to date. Refer to the [Updating](./updating.md) guide to learn more. +Once you start using versioned modules, it’s important to keep the modules up to date. Refer to the [Updating](./updating.md) guide to learn more. diff --git a/static/img/iac/stay-up-to-date/versioning/module_release_tag_versions.png b/static/img/iac/stay-up-to-date/versioning/module_release_tag_versions.png new file mode 100644 index 0000000000..009d5071e0 Binary files /dev/null and b/static/img/iac/stay-up-to-date/versioning/module_release_tag_versions.png differ