Skip to content

Commit a8193f3

Browse files
Apply suggestions from code review
Co-authored-by: Brian McClain <brianmmcclain@gmail.com>
1 parent c78924a commit a8193f3

File tree

7 files changed

+12
-38
lines changed

7 files changed

+12
-38
lines changed

content/terraform/v1.13.x/docs/language/meta-arguments/count.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how the `count` meta-argument works in Terraform configuratio
55

66
# `count` reference
77

8-
By default, [`resource` block](/terraform/language/block/resource) configures one real infrastructure object. Similarly, a [`module` block](/terraform/language/block/module) includes a child module's contents into the configuration one time.
8+
By default, each [`resource` block](/terraform/language/block/resource) and [`ephemeral` block](/terraform/language/block/ephemeral) configures one real infrastructure object. Similarly, a [`module` block](/terraform/language/block/module) includes a child module's contents into the configuration one time.
99

1010
Use the `count` meta-argument to manage several similar objects, such as a fixed pool of compute instances, without writing a separate block for each object. When a `resource` or `module` block includes a `count` argument whose value is a whole number, Terraform creates that many instances.
1111

content/terraform/v1.13.x/docs/language/meta-arguments/depends_on.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ You can use `depends_on` in the following Terraform configuration blocks:
8484

8585
The following use cases describe common patterns for the `depends_on` argument.
8686

87-
8887
### Specify a dependency during validation
8988

9089
Add a `depends_on` argument to a `data` block nested in a [`check` block](/terraform/language/block/check) validation when the data source depends on another resource but doesn't reference the resource directly.
@@ -113,7 +112,7 @@ check "database_connection" {
113112

114113
### Create a database service that other services depend on
115114

116-
In the following example, Terraform must launch the `aws_db_instance` service first so that `aws_instance` can connect to it:
115+
In the following example, Terraform must launch the `aws_db_instance` service first so that `aws_instance` can connect to it:
117116

118117
```hcl
119118
provider "aws" {

content/terraform/v1.13.x/docs/language/meta-arguments/for_each.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Use the `for_each` meta-argument to manage several similar objects, such as a fi
1313

1414
The `for_each` meta-argument accepts a map or a set of strings and creates an instance for each item in that map or set. Each instance is associated with a distinct infrastructure object. Terraform creates, updates, or destroys each instance when applying changes to the configuration.
1515

16-
You can use pure functions, such as `toset()` and `tomap()`, to create a map or set for use in the `for_each` argument. Whether iterating over the keys of a map or set of strings, all must be known values. Otherwise, Terraform prints an error message that `for_each` has dependencies that it cannot determine before applying the configuration.
16+
You can use pure functions, such as `toset()` and `tomap()`, to create a map or set for use in the `for_each` argument. All values that the `for_each` argument iterates over must be known before Terraform performs any remote resource operations. Specifying references to resource attributes that are only known after a configuration is applied, such as a unique ID generated by the remote API when an object is created, will result in an error.
1717

1818
The following example creates two `azurerm_resource_group` resources that reference a map created using the `tomap()` function:
1919

@@ -51,7 +51,7 @@ In many cases, you can use a `for` expression to achieve similar results. For ex
5151

5252
### Expressions in `for_each`
5353

54-
The `for_each` meta-argument accepts map or set [expressions](/terraform/language/expressions), but unlike most arguments, the value must be known before Terraform performs any remote resource actions. As a result, `for_each` can't refer to any resource attributes that aren't known until after a
54+
The `for_each` meta-argument accepts map or set [expressions](/terraform/language/expressions), but unlike most arguments, the value must be known before Terraform performs any remote resource actions. As a result, `for_each` can't refer to any resource attributes that aren't known until after a
5555
configuration is applied, such as a unique ID generated by the remote API when
5656
an object is created.
5757

content/terraform/v1.13.x/docs/language/meta-arguments/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Meta-arguments are built-in Terraform arguments that determine how
55

66
# Meta-arguments
77

8-
Meta-arguments are a class of arguments built into the Terraform configuration language that control how Terraform creates your infrastructure. You can use meta-arguments in any type of resource, including resources created with `data` blocks. You can also use most meta-arguments in `module` blocks.
8+
Meta-arguments are a class of arguments built into the Terraform configuration language that control how Terraform creates and manages your infrastructure. You can use meta-arguments in any type of resource. You can also use most meta-arguments in `module` blocks.
99

1010
The provider developer determines resource-specific arguments, but all resources support meta-arguments that let you manage resources' infrastructure lifecycle, including destruction behavior, preventing destruction, and establishing dependencies between resources. Terraform provides the following meta-arguments.
1111

@@ -23,7 +23,7 @@ The `depends_on` meta-argument establishes dependencies between resources that d
2323
2424
## `count`
2525

26-
By default, Terraform manages one infrastructure object for each `resource` block. Terraform also creates single instances of a module per `module` block. You can use the `count` argument in `resource` and `module` blocks to create and manage multiple instances of each without writing a separate block for each instance. Refer to the [`count` reference](/terraform/language/meta-arguments/count) for details.
26+
By default, Terraform configures one infrastructure object for each `resource`, `module`, and `ephemeral` block. Terraform also creates single instances of a module per `module` block. You can add the `count` argument to `resource`, `module`, and `ephemeral` blocks to create and manage multiple instances of each without writing a separate block for each instance. Refer to the [`count` reference](/terraform/language/meta-arguments/count) for details.
2727

2828
> **Hands-on**: Complete the [Manage similar resources with count](/terraform/tutorials/0-13/count) tutorial to learn how to create multiple instances of a resource.
2929

content/terraform/v1.13.x/docs/language/meta-arguments/lifecycle.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ This is an opt-in behavior because many remote object types have unique name req
2929
Note that Terraform propagates and applies the `create_before_destroy` meta-attribute behavior to all resource dependencies. For example, if `create_before_destroy` is enabled on resource `A` but not on resource `B`, but resource `A` is dependent on resource `B`, then Terraform enables `create_before_destroy` for resource `B` implicitly by default and stores it to the state file. You cannot override `create_before_destroy`
3030
to `false` on resource `B` because that would imply dependency cycles in the graph.
3131

32-
Destroy provisioners of this resource do not run if `create_before_destroy`
33-
is set to `true`. This [GitHub issue](https://github.com/hashicorp/terraform/issues/13549) contains more details.
32+
When the resource contains a provisioner that runs during the `destroy` operation, setting `create_before_destroy` to `true` also prevents the provisioner from running.
3433

3534
You can use `create_before_destroy` in [`resource`](/terraform/language/block/resource) blocks.
3635

@@ -44,7 +43,6 @@ and prevents the `terraform destroy` command from operating once such objects ar
4443

4544
You can use `prevent_destroy` in in [`resource`](/terraform/language/block/resource) blocks.
4645

47-
4846
### `ignore_changes`
4947

5048
By default, Terraform detects any difference in the current settings of a real infrastructure object and plans to update the remote object to match configuration. Use the `ignore_changes` argument when a resource is created with references to data that may change in the future, but should not affect the resource after its creation.

content/terraform/v1.13.x/docs/language/meta-arguments/provider.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type name. Note that the `provider` argument is distinct from the [`provider` bl
1313

1414
By default, Terraform determines the local name of the provider from the first word in the resource type and uses that provider's default configuration to create the resource. For example, the resource type `google_compute_instance` automatically uses the default configuration for the `google` provider.
1515

16-
You can add multiple `provider` blocks to your configuration and use the `provider` argument to a resource definition to specify which provider it should use. For its value, the `provider` argument expects a reference formatted as [`<PROVIDER>.<ALIAS>`](/terraform/language/providers/configuration#referring-to-alternate-provider-configurations). In the following example, the `google_compute_instance` resource selects the provider configuration with the `europe` alias.
16+
You can add multiple `provider` blocks to your configuration and use the `provider` argument to a resource definition to specify which provider it should use. For its value, the `provider` argument expects a reference formatted as `<PROVIDER>.<ALIAS>`. In the following example, the `google_compute_instance` resource selects the provider configuration with the `europe` alias.
1717

1818
```hcl
1919
provider "google" {

content/terraform/v1.13.x/docs/language/meta-arguments/providers.mdx

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ By default, child modules inherit the default provider configurations of their p
99

1010
## Usage
1111

12-
In a [`module` block](/terraform/language/module/syntax), you can add the optional `providers` meta-argument to specify which [provider configurations](/terraform/language/modules/configuration) from the parent module is available inside the child module.
12+
In a [`module` block](/terraform/language/block/module), you can add the optional `providers` meta-argument to specify which [provider configurations](/terraform/language/modules/configuration) from the parent module is available inside the child module.
1313

1414
The value of `providers` is a map, where the keys are the provider configuration names used inside the child module and the values are provider configuration names from the parent module.
1515

@@ -50,7 +50,6 @@ The `providers` argument is optional when the child module does not declare a [`
5050

5151
Specifying a `providers` argument cancels the default behavior. As a result, the child module only has access to the provider configurations you specify.
5252

53-
5453
### When to specify `providers`
5554

5655
Add the `providers` argument when one of the following conditions apply:
@@ -86,36 +85,14 @@ You can use `providers` in the following Terraform configuration blocks:
8685

8786
The following use cases describe common patterns for the `providers` argument.
8887

89-
### Apply different provider configurations for module resources
90-
91-
In the following example, the `tunnel` module includes resources that support their own provider configuration. As a result, each resource alias maps to a different provider configurations declared in the root module:
92-
93-
```hcl
94-
provider "aws" {
95-
alias = "usw1"
96-
region = "us-west-1"
97-
}
98-
99-
provider "aws" {
100-
alias = "usw2"
101-
region = "us-west-2"
102-
}
103-
104-
module "tunnel" {
105-
source = "./tunnel"
106-
providers = {
107-
aws.src = aws.usw1
108-
aws.dst = aws.usw2
109-
}
110-
}
111-
```
112-
11388
### Modules with alternate provider configurations
11489

11590
In rare cases, a single re-usable module might require multiple configurations
11691
of the same provider. For example, a module that configures connectivity between
11792
networks in two AWS regions is likely to need both a `source` and a `destination`
118-
region. The following example shows possible root module configuration for this use case:
93+
region.
94+
95+
In the following example, the `tunnel` module includes resources that support their own provider configuration. As a result, each resource alias maps to a different provider configurations declared in the root module:
11996

12097
```hcl
12198
provider "aws" {

0 commit comments

Comments
 (0)