You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This brings together the provider-level and `provider_meta` module-scoped sections to provide a more complete picture of all the ways in which User-Agent headers can be extended.
### Module-scoped User-Agent Information with `provider_meta`
238
-
239
-
The AWS provider supports sending provider metadata via the [`provider_meta` block](https://developer.hashicorp.com/terraform/internals/provider-meta).
240
-
This block allows module authors to provide additional information in the `User-Agent` header, scoped only to resources defined in a given module.
241
-
242
-
For example, the following `terraform` block can be used to append additional User-Agent details.
243
-
244
-
```terraform
245
-
terraform {
246
-
required_providers {
247
-
aws = {
248
-
source = "hashicorp/aws"
249
-
version = "~> 6.0"
250
-
}
251
-
}
252
-
253
-
provider_meta "aws" {
254
-
user_agent = [
255
-
"example-demo/0.0.1 (a demo module)"
256
-
]
257
-
}
258
-
}
259
-
```
260
-
261
-
Note that `provider_meta` is defined within the `terraform` block.
262
-
The `provider` block is inherited from the root module.
@@ -329,16 +302,66 @@ See the assume role documentation [section on web identities](https://docs.aws.a
329
302
## Custom User-Agent Information
330
303
331
304
By default, the underlying AWS client used by the Terraform AWS Provider creates requests with User-Agent headers including information about Terraform and AWS SDK for Go versions.
332
-
To provide additional information in the User-Agent headers, set the `TF_APPEND_USER_AGENT` environment variable, or use the `user_agent` block.
333
305
334
-
When using the environment variable, the value will be directly appended to the User-Agent header.
306
+
There are three ways to provide additional User-Agent information.
307
+
308
+
1. The `user_agent` provider argument.
309
+
1. The `TF_APPEND_USER_AGENT` environment variable.
310
+
1. The [`provider_meta`](https://developer.hashicorp.com/terraform/internals/provider-meta)`user_agent` argument.
311
+
312
+
The first two options will apply the additional information to all resources, while `provider_meta` will be scoped only to the module in which it is configured.
313
+
314
+
### `user_agent` Provider Argument
315
+
316
+
When using the `user_agent` provider argument, the items will be appended to the User-Agent header in order.
317
+
318
+
For example,
319
+
320
+
~> The [`user_agent`](./functions/user_agent.html.markdown) provider-defined function can be used to format the name, version, and comment components.
321
+
322
+
```terraform
323
+
provider "aws" {
324
+
user_agent = [
325
+
provider::aws::user_agent("example-demo", "0.0.1", "a comment"),
326
+
]
327
+
}
328
+
```
329
+
330
+
### `TF_APPEND_USER_AGENT` Environment Variable
331
+
332
+
When using the environment variable, the provided value will be directly appended to the User-Agent header.
335
333
For example,
336
334
337
335
```console
338
336
% export TF_APPEND_USER_AGENT="JenkinsAgent/i-12345678 BuildID/1234 (Optional Extra Information)"
339
337
```
340
338
341
-
When using the `user_agent` list attribute, the items will be appended to the User-Agent in order.
339
+
### `provider_meta``user_agent` Argument
340
+
341
+
The AWS provider supports sending provider metadata via the [`provider_meta` block](https://developer.hashicorp.com/terraform/internals/provider-meta).
342
+
This block allows module authors to provide additional information in the `User-Agent` header, scoped only to resources defined in a given module.
343
+
344
+
For example,
345
+
346
+
~> In a module, `provider_meta` is defined within the `terraform` block.
347
+
The `provider` block is inherited from the root module.
348
+
349
+
```terraform
350
+
terraform {
351
+
required_providers {
352
+
aws = {
353
+
source = "hashicorp/aws"
354
+
version = "~> 6.0"
355
+
}
356
+
}
357
+
358
+
provider_meta "aws" {
359
+
user_agent = [
360
+
provider::aws::user_agent("example-demo", "0.0.1", "a comment"),
0 commit comments