Skip to content

Commit d638a11

Browse files
[CORE-979] Cleanup old content (#866)
* Remove API reference pages * Remove working with code pages * Remove intro guide pages * Remove core-concepts, environment-setup, first-deployment and tool-fundamentals pages * Remove old reference architecture guide * Fix link references * Regenerate stay up to date guides and fix broken links * Hide old guides * Add back sidebar for compliance guide * move production framework to footer * Add production framework sidebar back * fix issues after updating from master * fix image link * revert change to stay up to date * fix broken link * re-run docs-sourcer with new changes --------- Co-authored-by: Maxwell Moon <[email protected]>
1 parent 56f9e4f commit d638a11

File tree

225 files changed

+469
-16980
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+469
-16980
lines changed

_docs-sources/guides/build-it-yourself/achieve-compliance/deployment-walkthrough/deploy-landing-zone-solution/apply-account-baseline-root-to-root-account.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ We’ll be using the `landingzone/account-baseline-root` module from [terraform-
6060
This guide will use [Terragrunt](https://github.com/gruntwork-io/terragrunt) and its associated file and folder
6161
structure to deploy Terraform modules. Please note that **Terragrunt is NOT required for using Terraform modules from the Gruntwork Infrastructure as Code Library.** Check out our [Introduction to Gruntwork](/intro/overview/intro-to-gruntwork) section
6262
for instructions on alternative options, such as how to
63-
[deploying how to use plain terraform](/intro/first-deployment/deploy#deploy-using-plain-terraform).
63+
[deploying how to use plain terraform](/library/getting-started/deploying-a-module).
6464

6565
:::
6666

_docs-sources/guides/build-it-yourself/achieve-compliance/deployment-walkthrough/prepare-your-infrastructure-live-repository.md

Lines changed: 174 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,178 @@
22
sidebar_label: Prepare your infrastructure-live repository
33
---
44

5-
# Prepare your `infrastructure-live` repository
5+
# Prepare your infrastructure-live repository
66

7-
We’ve previously described exactly how to prepare your repository in the
8-
[Gruntwork Landing Zone guide](../../landing-zone/deployment-walkthrough/prepare-your-infrastructure-live-repository.md). Follow the steps in that section to get your `infrastructure-live` repository set up for the next steps.
7+
:::info Terragrunt not required
8+
9+
This guide uses [Terragrunt](https://github.com/gruntwork-io/terragrunt) and its associated file and folder
10+
structure to deploy Terraform modules. Please note that **Terragrunt is NOT required for using Terraform modules from
11+
the Gruntwork Infrastructure as Code Library.** Check out our [Introduction to Gruntwork](/intro/overview/intro-to-gruntwork)
12+
for instructions on alternative options, such as
13+
[deploying with plain Terraform](/library/getting-started/deploying-a-module).
14+
15+
:::
16+
17+
Now we’re going to make some HCL files that store variables to be used across your modules. _You won’t be able to fill
18+
everything out just yet._ Your AWS account IDs will be generated after applying the `account-baseline-root` to the root
19+
account. At that point you can update these files. Create them now to have them ready to use.
20+
21+
For example, assuming `us-east-1` is your default region, your directory structure would look like the following, with
22+
`_global` and `<region>` directories in each account directory:
23+
24+
```bash
25+
infrastructure-live
26+
└ common.hcl
27+
└ accounts.json
28+
└ terragrunt.hcl
29+
└ dev
30+
└ logs
31+
└ stage
32+
└ security
33+
└ shared
34+
└ prod
35+
└ _global
36+
└ region.hcl
37+
└ us-east-1
38+
└ region.hcl
39+
```
40+
41+
The Terraform modules in the [Service Catalog](https://github.com/gruntwork-io/terraform-aws-service-catalog/)
42+
do not define some blocks that are required for Terraform to operate (e.g., the `provider` and `terraform`
43+
state backend blocks). This is to allow the modules to be flexibly used in different contexts.
44+
We’ll define a root `terragrunt.hcl` that injects these these required blocks.
45+
46+
Create a `terragrunt.hcl` at the root of your infrastructure-live repo and insert the following contents. As you can
47+
see, it references `common`, `account`, and `region` HCL files which we’ll create shortly.
48+
49+
```hcl title=infrastructure-live/terragrunt.hcl
50+
# -----------------------------------------------------------------------------
51+
# TERRAGRUNT CONFIGURATION
52+
# -----------------------------------------------------------------------------
53+
54+
locals {
55+
common_vars = read_terragrunt_config("${get_terragrunt_dir()}/common.hcl")
56+
account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
57+
region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
58+
59+
name_prefix = local.common_vars.locals.name_prefix
60+
account_name = local.account_vars.locals.account_name
61+
account_id = local.account_vars.locals.account_id
62+
default_region = local.common_vars.locals.default_region
63+
aws_region = local.region_vars["aws_region"]
64+
}
65+
66+
# -----------------------------------------------------------------------------
67+
# GENERATED PROVIDER BLOCK
68+
# -----------------------------------------------------------------------------
69+
70+
generate "provider" {
71+
path = "provider.tf"
72+
if_exists = "overwrite_terragrunt"
73+
contents = <<EOF
74+
provider "aws" {
75+
region = "${local.aws_region}"
76+
version = ">= 3.13.0"
77+
# Only these AWS Account IDs may be operated on by this template
78+
allowed_account_ids = ["${local.account_id}"]
79+
}
80+
EOF
81+
}
82+
83+
# -----------------------------------------------------------------------------
84+
# GENERATED REMOTE STATE BLOCK
85+
# -----------------------------------------------------------------------------
86+
87+
remote_state {
88+
backend = "s3"
89+
generate = {
90+
path = "backend.tf"
91+
if_exists = "overwrite_terragrunt"
92+
}
93+
config = {
94+
encrypt = true
95+
bucket = "${local.name_prefix}-${local.account_name}-${local.aws_region}-terraform-state"
96+
key = "${path_relative_to_include()}/terraform.tfstate"
97+
region = local.default_region
98+
dynamodb_table = "terraform-locks"
99+
}
100+
}
101+
102+
# -----------------------------------------------------------------------------
103+
# GLOBAL PARAMETERS
104+
# -----------------------------------------------------------------------------
105+
106+
inputs = {
107+
# Set commonly used inputs globally to keep child terragrunt.hcl files DRY
108+
aws_account_id = local.account_id
109+
aws_region = local.aws_region
110+
name_prefix = local.name_prefix
111+
}
112+
```
113+
114+
Also create a `common.hcl` file at the root of your `infrastructure-live` repo, with the following contents.
115+
116+
```hcl title=infrastructure-live/common.hcl
117+
locals {
118+
# TODO: Enter a unique name prefix to set for all resources created in your accounts, e.g., your org name.
119+
name_prefix = ""
120+
# TODO: Enter the default AWS region, the same as where the terraform state S3 bucket is currently provisioned.
121+
default_region = ""
122+
123+
# TODO: Fill these in after applying the account-baseline-root to the root account.
124+
config_s3_bucket_name = ""
125+
cloudtrail_s3_bucket_name = ""
126+
cloudtrail_kms_key_arn = ""
127+
128+
# TODO: An accounts map to conveniently store all account IDs.
129+
# Centrally define all the AWS account IDs. We use JSON so that it can be readily parsed outside of Terraform.
130+
accounts = jsondecode(file("accounts.json"))
131+
}
132+
```
133+
134+
This file references an `accounts.json`, which you should also create at the root of the repo. _You will fill out
135+
the account IDs after applying the account-baseline-root to the root account._
136+
137+
```json title=infrastructure-live/accounts.json
138+
{
139+
"dev": "",
140+
"logs": "",
141+
"prod": "",
142+
"security": "",
143+
"shared": "",
144+
"stage": ""
145+
}
146+
```
147+
148+
In each account folder (e.g., `infrastructure-live/dev`, `infrastructure-live/shared`, etc.), add a file named
149+
`account.hcl` with the following contents. _Leave `account_id` blank until after the `account-baseline-root` has been
150+
applied to the root account._
151+
152+
```hcl
153+
locals {
154+
# TODO: Update with the actual information of each account
155+
# The user friendly name of the AWS account. Usually matches the folder name.
156+
account_name = ""
157+
# The 12 digit ID number of your AWS account.
158+
account_id = ""
159+
}
160+
```
161+
162+
Now in each `infrastructure-live/<account_name>/_global/` folder, create a `region.hcl` file.
163+
164+
```hcl
165+
# Modules in the account _global folder don't live in any specific AWS region, but you still have to send the API calls
166+
# to _some_ AWS region, so here we use the default region for those API calls.
167+
locals {
168+
aws_region = read_terragrunt_config(find_in_parent_folders("common.hcl")).locals.default_region
169+
}
170+
```
171+
172+
Do the same in each region folder (e.g., `infrastructure-live/dev/us-east-1/`). This `region.hcl` file is a bit different.
173+
174+
```hcl
175+
locals {
176+
# TODO: Enter the region to use for all resources in this subfolder.
177+
aws_region = ""
178+
}
179+
```

_docs-sources/guides/build-it-yourself/achieve-compliance/production-grade-design/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pagination_label: Production-grade Design
66

77
In [core concepts](../core-concepts/intro.md) we discussed the basics of the AWS Foundations Benchmark. Although it's possible to achieve
88
compliance with the Benchmark by manually configuring each setting in the web console or entering the CLI commands, we
9-
strongly discourage this approach. It precludes [the myriad benefits of using code to manage infrastructure](/intro/core-concepts/infrastructure-as-code).
9+
strongly discourage this approach. It precludes [the myriad benefits of using code to manage infrastructure](/library/overview).
1010

1111
Instead, we advise using [Terraform](https://www.terraform.io) (or similar tools, such as
1212
[CloudFormation](https://aws.amazon.com/cloudformation/) or [Pulumi](https://www.pulumi.com/) to configure cloud

_docs-sources/guides/build-it-yourself/index.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

_docs-sources/guides/build-it-yourself/kubernetes-cluster/deployment-walkthrough/deploy-the-vpc.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ module "dns_mgmt_to_app" {
107107
```
108108

109109
At this point, you’ll want to test your code. See
110-
[Manual tests for Terraform code](/intro/first-deployment/testing#manual-tests-for-terraform-code)
111-
and
112-
[Automated tests for Terraform code](/intro/first-deployment/testing#automated-tests-for-terraform-code)
113-
for instructions.
110+
[Manual tests for Terraform code](/library/usage/using-the-library#testing-terraform-only) for instructions.
114111

115112
Once your updated `vpc-app` wrapper module is working the way you want, submit a pull request, get your changes merged
116113
into the `master` branch, and create a new versioned release by using a Git tag. For example, to create a `v0.5.0`
@@ -128,7 +125,7 @@ structure to deploy Terraform modules. Please note that **Terragrunt is NOT requ
128125
the Gruntwork Infrastructure as Code Library.** Check out
129126
our [Introduction to Gruntwork](/intro/overview/intro-to-gruntwork) for instructions
130127
on alternative options, such as how to
131-
[Deploy using plain Terraform](/intro/first-deployment/deploy#deploy-using-plain-terraform).
128+
[Deploy using plain Terraform](/library/getting-started/deploying-a-module).
132129

133130
:::
134131

_docs-sources/guides/build-it-yourself/landing-zone/deployment-walkthrough/prepare-your-infrastructure-live-repository.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This guide uses [Terragrunt](https://github.com/gruntwork-io/terragrunt) and its
66
structure to deploy Terraform modules. Please note that **Terragrunt is NOT required for using Terraform modules from
77
the Gruntwork Infrastructure as Code Library.** Check out our [Introduction to Gruntwork](/intro/overview/intro-to-gruntwork)
88
for instructions on alternative options, such as
9-
[deploying with plain Terraform](/intro/first-deployment/deploy#deploy-using-plain-terraform).
9+
[deploying with plain Terraform](/library/getting-started/deploying-a-module).
1010

1111
:::
1212

0 commit comments

Comments
 (0)