Skip to content

Commit a3da6f1

Browse files
rhoboatbrikis98eak12913docs-sourcer[bot]
authored
Write Upgrade Guide for AWS Provider v4. (#491)
Co-authored-by: Yevgeniy Brikman <[email protected]> Co-authored-by: Eugene K <[email protected]> Co-authored-by: docs-sourcer[bot] <99042413+docs-sourcer[bot]@users.noreply.github.com>
1 parent 3710abe commit a3da6f1

File tree

12 files changed

+556
-48
lines changed

12 files changed

+556
-48
lines changed

_docs-sources/guides/stay-up-to-date/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ href="/guides/stay-up-to-date/terraform/terraform-1.1"
4040
title="Update to Terraform 12"
4141
href="/guides/stay-up-to-date/terraform/terraform-12"
4242
/>
43+
<Card
44+
title="Update to Version 4 of the Terraform provider"
45+
href="/guides/stay-up-to-date/terraform/how-to-update-to-aws-provider-v4"
46+
/>
4347
<Card
4448
title="Update to Version 3 of the Terraform provider"
4549
href="/guides/stay-up-to-date/terraform/how-to-update-to-aws-provider-v3"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Core Concepts
2+
3+
Version [v4.0.0](https://github.com/terraform-providers/terraform-provider-aws/releases/tag/v4.0.0)
4+
of the Terraform AWS provider was released on February 10th 2022 with backward incompatible updates. Following the
5+
provider release cycle, future releases from this point onward would only be compatible with 4.X. This means that if
6+
you wish to use any new resources or data sources that are released from this point onwards, you will need to be
7+
compatible with version 4 of the AWS provider to be able to pull those changes in.
8+
9+
Originally v4 was a backward incompatible update, but since v4.9.0, released April 7th 2022, it has become backward
10+
compatible. When bumping your versions, HashiCorp recommends using a version v4.9.0 or newer. For your own code,
11+
you can follow [the official guide](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade)
12+
on updating to AWS provider version 4. The rest of this guide will focus on updating references to Gruntwork
13+
modules and the Gruntwork Reference Architecture to be compatible with AWS provider version 4.
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Deployment walkthrough
2+
3+
## Updating references to Gruntwork Infrastructure as Code Library
4+
5+
In order to take advantage of the Terraform AWS provider version 4, you need to update your references to the Gruntwork
6+
Infrastructure as Code Library to use a compatible version. We (Gruntwork) have gone through all our modules in the
7+
library to test and update the code to be compatible with AWS provider version 4. As a customer, you need to update to
8+
the proper versions of the Gruntwork library to pick up the fixes/changes that were made to be compatible. Be sure to
9+
read the release notes to know what changes need to be made to update to that version.
10+
11+
Refer to our guide on ["Updating to new versions"](/guides/working-with-code/versioning#updating-to-new-versions)
12+
for instructions on how to update the versions in your code.
13+
14+
The following table lists the versions of relevant Gruntwork AWS IaC library modules and Service Catalogs which are
15+
compatible with AWS provider version 4. Since the AWS provider version 3 upgrade, we have sunsetted some of our module
16+
repos. They have not been updated and are not listed below. Please visit the repo READMEs to see our recommendations
17+
for alternatives to those modules.
18+
19+
:::caution
20+
21+
Gruntwork follows [semantic versioning](/guides/working-with-code/versioning#semantic-versioning).
22+
For pre-1.0 modules, version updates to the _minor_ version are considered backward incompatible releases. Make sure to
23+
read the release notes for the relevant modules anytime you are updating minor versions! For example, if you are going
24+
from `v0.5.x` to `v0.9.x`, read the notes for `v0.6.0`, `v0.7.0`, `v0.8.0`, and `v0.9.0` to get the migration steps for
25+
all backward incompatible updates in your upgrade path.
26+
27+
:::
28+
29+
## Version Compatibility table
30+
31+
<table>
32+
<colgroup>
33+
<col />
34+
<col />
35+
</colgroup>
36+
<tbody>
37+
<tr className="odd">
38+
<td><p><strong>Gruntwork Repo</strong></p></td>
39+
<td><p><strong>Minimum version with AWS Provider v4 support</strong></p></td>
40+
</tr>
41+
<tr className="even">
42+
<td><p>terraform-aws-utilities</p></td>
43+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-utilities/releases/tag/v0.9.0">v0.9.0</a></strong></p></td>
44+
</tr>
45+
<tr className="odd">
46+
<td><p>terraform-aws-vpc</p></td>
47+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-vpc/releases/tag/v0.22.0">v0.22.0</a></strong></p></td>
48+
</tr>
49+
<tr className="even">
50+
<td><p>terraform-aws-asg</p></td>
51+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-asg/releases/tag/v0.19.0">v0.19.0</a></strong></p></td>
52+
</tr>
53+
<tr className="odd">
54+
<td><p>terraform-aws-server</p></td>
55+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-server/releases/tag/v0.15.0">v0.15.0</a></strong></p></td>
56+
</tr>
57+
<tr className="even">
58+
<td><p>terraform-aws-lambda</p></td>
59+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-lambda/releases/tag/v0.20.0">v0.20.0</a></strong></p></td>
60+
</tr>
61+
<tr className="odd">
62+
<td><p>terraform-aws-security</p></td>
63+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-security/releases/tag/v0.65.0">v0.65.0</a></strong></p></td>
64+
</tr>
65+
<tr className="even">
66+
<td><p>terraform-aws-load-balancer</p></td>
67+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-load-balancer/releases/tag/v0.29.0">v0.29.0</a></strong></p></td>
68+
</tr>
69+
<tr className="odd">
70+
<td><p>terraform-aws-data-storage</p></td>
71+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-data-storage/releases/tag/v0.24.0">v0.24.0</a></strong></p></td>
72+
</tr>
73+
<tr className="even">
74+
<td><p>terraform-aws-cache</p></td>
75+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-cache/releases/tag/v0.18.0">v0.18.0</a></strong></p></td>
76+
</tr>
77+
<tr className="odd">
78+
<td><p>terraform-aws-messaging</p></td>
79+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-messaging/releases/tag/v0.9.0">v0.9.0</a></strong></p></td>
80+
</tr>
81+
<tr className="even">
82+
<td><p>terraform-aws-static-assets</p></td>
83+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-static-assets/releases/tag/v0.15.0">v0.15.0</a></strong></p></td>
84+
</tr>
85+
<tr className="odd">
86+
<td><p>terraform-aws-monitoring</p></td>
87+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-monitoring/releases/tag/v0.34.1">v0.34.1</a></strong></p></td>
88+
</tr>
89+
<tr className="even">
90+
<td><p>terraform-aws-openvpn</p></td>
91+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-openvpn/releases/tag/v0.24.0">v0.24.0</a></strong></p></td>
92+
</tr>
93+
<tr className="odd">
94+
<td><p>terraform-aws-ecs</p></td>
95+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-ecs/releases/tag/v0.34.0">v0.34.0</a></strong></p></td>
96+
</tr>
97+
<tr className="even">
98+
<td><p>terraform-aws-ci</p></td>
99+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-ci/releases/tag/v0.48.0">v0.48.0</a></strong></p></td>
100+
</tr>
101+
<tr className="odd">
102+
<td><p>terraform-aws-eks</p></td>
103+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-eks/releases/tag/v0.53.0">v0.53.0</a></strong></p></td>
104+
</tr>
105+
<tr className="even">
106+
<td><p>terraform-aws-service-catalog</p></td>
107+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-service-catalog/releases/tag/v0.96.1">v0.96.1</a></strong></p></td>
108+
</tr>
109+
<tr className="odd">
110+
<td><p>terraform-aws-cis-service-catalog</p></td>
111+
<td><p><strong><a href="https://github.com/gruntwork-io/terraform-aws-cis-service-catalog/releases/tag/v0.41.0">v0.41.0</a></strong></p></td>
112+
</tr>
113+
</tbody>
114+
</table>
115+
116+
## Update the Gruntwork Reference Architecture to AWS Provider v4
117+
118+
If you purchased the Gruntwork Reference Architecture, update the relevant code in `infrastructure-live` to use a
119+
compatible version of the Gruntwork Infrastructure as Code Library, as per
120+
[the compatibility table](#version-compatibility-table) above.
121+
122+
To update your Reference Architecture:
123+
124+
1. Update the underlying module source versions being referenced.
125+
- We recommend using tools like `ripgrep`, `xargs`, and `sed` to accomplish this.
126+
- E.g.: `rg v0.95.0 --files-with-matches | xargs sed -i '' "s|v0.95.0|v0.96.1|g"`. This command finds and replaces
127+
all instances of `v0.95.0` with `v0.96.1` in your repo. Double-check all your changes before committing them to
128+
version control.
129+
- If you are several minors behind, please follow the migration guide for each minor version bump. Use the
130+
find-and-replace command to bump one minor version at a time.
131+
- Update the underlying Service Catalog versions, and also any one-off library module versions as well. You
132+
can accomplish this by grepping for each of the repos in the table above.
133+
1. Run `terraform init -upgrade` to allow Terraform to pull in the latest provider version. Without the `-upgrade` flag
134+
the `3.75.X` version of the provider will be used instead. The `-upgrade` flag allows unlocking the provider
135+
restriction enforced in `terraform.lock.hcl`, in the module folder.
136+
1. Follow up with `terraform plan`. NOTE: The provider update creates and updates resources. You will see changes in
137+
the `plan`. These should be safe to `apply`, but always double-check anything slated for destruction.
138+
1. Then run `terraform apply` to bring Terraform state in sync with the provider changes.
139+
140+
If you have any questions, we'd love to hear them. Please reach out to <a href="mailto:[email protected]">Gruntwork Support</a>.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Upgrade to AWS Provider v4
2+
3+
This guide will walk you through how to update the [Gruntwork Reference
4+
Architecture](https://gruntwork.io/reference-architecture/) and any code that depends on the
5+
[Gruntwork Infrastructure as Code Library](https://gruntwork.io/infrastructure-as-code-library/) to version 4.x of the
6+
Terraform AWS provider. Following the release of v4.0.0, new features and bug fixes will only be available on version
7+
4.x, but it also has a number of backward incompatibilities that have to be incorporated into your codebase.
8+
9+
## What you’ll learn in this guide
10+
11+
This guide consists of two main sections:
12+
13+
<div className="dlist">
14+
15+
#### [Core Concepts](core-concepts.md)
16+
17+
An overview of version 4 of the AWS provider and why it is important to update your code for compatibility.
18+
19+
#### [Deployment walkthrough](deployment-walkthrough.md)
20+
21+
The steps you need to take to update your code relying on the Gruntwork Infrastructure as Code library and your
22+
version of the Gruntwork Reference Architecture with compatibility with AWS provider v4. Includes a [version
23+
compatibility table](deployment-walkthrough.md#version-compatibility-table) you can use as a reference to know
24+
which Gruntwork Repo version tag is compatible with AWS provider v4.
25+
26+
</div>

_docs-sources/guides/working-with-code/versioning.md

Lines changed: 73 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,92 @@
33
## Versioning
44

55
All of the code in the Gruntwork Infrastructure as Code Library is _versioned_. Every time we make a change, we put out a new
6-
versioned release, and announce it in the monthly
6+
versioned release, and announce it in the periodical
77
[Gruntwork Newsletter](https://blog.gruntwork.io/tagged/gruntwork-newsletter).
88

9-
![An example of all the versioned updates announced in the monthly Gruntwork Newsletter](/img/guides/stay-up-to-date/newsletter.png)
9+
![An example of all the versioned updates announced in the Gruntwork Newsletter](/img/guides/stay-up-to-date/newsletter.png)
1010

1111
### Pinned Versions
1212

13-
When you use the code from the Gruntwork Infrastructure as Code Library, you pin
14-
yourself to a specific version of the code. That way, you are not accidentally affected by any subsequent changes in
15-
the Gruntwork Infrastructure as Code Library until you explicitly choose to pull those changes in. And when you do want to pull the
16-
changes in, it’s just a matter of bumping the version number!
13+
When you use the code from the Gruntwork IaC Library, you pin yourself to a specific version of the code. That way
14+
you are not accidentally affected by any subsequent changes in the Gruntwork IaC Library until you explicitly choose to
15+
pull those changes in. When you do want to pull the changes in, be sure to read through the release notes for any
16+
migration steps you need to take and then bump the version number accordingly.
1717

1818
### Semantic Versioning
1919

2020
We use version numbers of the form `MAJOR.MINOR.PATCH` (e.g., `1.2.3`), following the principles of
2121
_[semantic versioning](https://semver.org)_. In traditional semantic versioning, you increment the:
2222

23-
1. MAJOR version when you make incompatible API changes,
24-
2. MINOR version when you add functionality in a backwards compatible manner, and
25-
3. PATCH version when you make backwards compatible bug fixes.
23+
1. MAJOR version when you make backward incompatible API changes,
24+
2. MINOR version when you add functionality in a backward compatible manner, and
25+
3. PATCH version when you make backward compatible bug fixes.
2626

27-
However, much of the Gruntwork Infrastructure as Code Library is still not at version `1.0.0`. Most of the Gruntwork Infrastructure as Code Library is using `0.MINOR.PATCH` version numbers. With `0.MINOR.PATCH`, the rules are a bit different, where you increment the:
27+
However, much of the Gruntwork IaC Library is still pre-`1.0.0`. Most of the Gruntwork IaC Library uses
28+
`0.MINOR.PATCH` version numbers. With `0.MINOR.PATCH`, the rules are a bit different, where you increment the:
2829

29-
1. MINOR version when you make incompatible API changes
30-
2. PATCH version when you add backwards compatible functionality or bug fixes.
30+
1. MINOR version when you make backward incompatible API changes, and
31+
2. PATCH version when you add backward compatible functionality or bug fixes.
32+
33+
### What changes are backward incompatible?
34+
35+
In the world of DevOps, we've inherited our view of toil, and that continues to describe what DevOps engineers expect
36+
as part of their daily grunt work. However with IaC, we can liberate ourselves from that thinking and automate more of
37+
the toil than before, and as automation and infrastructure APIs improve, we can expect much more of DevOps grunt work
38+
to become automated. What we think of as necessary toil is constantly evolving, so how we define our releases (i.e.,
39+
backward compatible or not) is also subject to this evolution.
40+
41+
We (Gruntwork) currently consider the following types of updates backward incompatible:
42+
43+
1. Any update that requires some toil by the user. This is a moving target. At the moment, actions like bumping a
44+
version number are not considered toil, but actions like running migration steps that modify Terraform state are
45+
considered toil. In the near future, bumping a version number could be toil, and we are working to remove the need
46+
for users to do that.
47+
48+
2. Any update that requires configuration changes by the user. When we release a new MINOR version in pre-`1.0.0`, we
49+
include a migration guide with explicit steps you can take to resolve the backward incompatibilities, such that the
50+
update becomes backward compatible for you.
51+
52+
3. Any update that incurs downtime for you. This includes changes that require recreating a resource that may be in
53+
use. Even if the update attempts to first create the new resource and then destroy the existing resource, the order of
54+
apply may not be guaranteed, and there could still be downtime during the hand-off.
55+
56+
4. Most updates that destroy resources. There are some cases where destroying resources is necessary and will not incur
57+
downtime, such as `null_resource`s that only exist as a stop-gap for something missing in the AWS API or the Terraform
58+
AWS provider API.
59+
60+
We try to err on the side of caution. Sometimes we release an update as MINOR even if it is functionally backward
61+
compatible. For example, the [AWS Provider v4 update](/guides/stay-up-to-date/terraform/how-to-update-to-aws-provider-v4)
62+
requires no configuration changes in Gruntwork module usage. It requires unlocking the provider version maintained in
63+
the `terraform.lock.hcl` file, which makes it somewhat backward incompatible. Additionally it may still require you to
64+
update any infrastructure code which does not use Gruntwork modules. Because this upgrade requires some vigilance, we
65+
released it as a MINOR version increase to signal importance.
66+
67+
We're working to provide automatic resolution with patches, i.e., scripts that you can run when bumping your versions,
68+
so that `terraform plan` and `terraform apply` result in clean updates. These releases would still be considered
69+
backward incompatible because they require running a patch, could cause downtime, or could change resources
70+
significantly.
3171

3272
## Updating to new versions
3373

74+
:::caution
75+
76+
In general, update one MINOR at a time, paying close attention to the release notes for migration steps. A MINOR
77+
version number increase (e.g., `v0.18.0``v0.19.0`) signals a backward incompatible change, and the release
78+
notes will contain a migration guide explaining what you need to do (e.g., update the configuration by adding,
79+
removing, or changing variables you pass to the module).
80+
81+
:::
82+
3483
Follow the steps below to keep your code up to date:
3584

36-
1. Make sure you're following our monthly [Gruntwork Newsletter](https://blog.gruntwork.io/tagged/gruntwork-newsletter) to be notified
37-
of all updates to the Gruntwork Infrastructure as Code Library. Alternatively, you can "watch" repos in GitHub that you’re
38-
interested in.
85+
1. Make sure you're following our [Gruntwork Newsletter](https://blog.gruntwork.io/tagged/gruntwork-newsletter)
86+
to be notified of all updates to the Gruntwork IaC Library. Alternatively, you can watch repos in GitHub that
87+
you’re interested in. If you use the Reference Architecture, you could watch the Service Catalog repos.
3988

40-
2. When you find an update you’d like for a specific module, update any code using that module in
41-
`infrastructure-modules` to the new version number. For example, if you were using `terraform-aws-vpc` at `v0.18.5` and you
42-
wanted to update to `v0.7.3`, you would change from:
89+
2. When you find an update you’d like for a specific module, update module sources referencing that module in your
90+
Terraform code to the new version number. For example, if you were using `terraform-aws-vpc` at `v0.18.5` and you
91+
wanted to update to `v0.18.6`, you would change from:
4392

4493
```hcl
4594
module "vpc" {
@@ -57,11 +106,12 @@ Follow the steps below to keep your code up to date:
57106
}
58107
```
59108
60-
3. Pay close attention to the release notes for any additional instructions. In particular, if the MINOR version number
61-
was increased (e.g., `v0.18.0` → `v0.19.0`), that implies a backwards incompatible change, and the release notes will
62-
explain what you need to do (e.g., you might have to add, remove, or change arguments you pass to the module).
109+
One way you can do this quickly is by stringing together commands using `ripgrep`, `xargs`, and `sed`, or any other
110+
method that allows find-and-replace operations within a directory.
63111
64-
4. Test your changes locally. You do this using the same process outlined in [Manual tests for Terraform code](/intro/first-deployment/testing#manual-tests-for-terraform-code) and
112+
3. Optionally, test your changes locally. Use the same process outlined in
113+
[Manual tests for Terraform code](/intro/first-deployment/testing#manual-tests-for-terraform-code) and
65114
[Automated tests for Terraform code](/intro/first-deployment/testing#automated-tests-for-terraform-code).
66115
67-
5. Deploy your changes to each environment. You do this using the same process outlined in [Deploying Terraform code](#deploy_terraform).
116+
4. Deploy your changes to each environment. Use `terraform plan` to sanity-check the changes before `terraform apply`.
117+
Use the same process outlined in [Deploying Terraform code](#deploy_terraform).

docs/guides/stay-up-to-date/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ href="/guides/stay-up-to-date/terraform/terraform-1.1"
4040
title="Update to Terraform 12"
4141
href="/guides/stay-up-to-date/terraform/terraform-12"
4242
/>
43+
<Card
44+
title="Update to Version 4 of the Terraform provider"
45+
href="/guides/stay-up-to-date/terraform/how-to-update-to-aws-provider-v4"
46+
/>
4347
<Card
4448
title="Update to Version 3 of the Terraform provider"
4549
href="/guides/stay-up-to-date/terraform/how-to-update-to-aws-provider-v3"
@@ -78,6 +82,6 @@ href="/guides/stay-up-to-date/terraform/terraform-1.1"
7882
<!-- ##DOCS-SOURCER-START
7983
{
8084
"sourcePlugin": "local-copier",
81-
"hash": "6108197b36342bbac59c8d32d9e3dfbb"
85+
"hash": "fcfce8df9f087e34a129afd5575e6df1"
8286
}
8387
##DOCS-SOURCER-END -->
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"label": "Update to version 4 of the Terraform AWS Provider"
3+
}

0 commit comments

Comments
 (0)