Skip to content

Commit 4970f73

Browse files
authored
[DOCS-11726] Add tabs for US1-FED account types (#31026)
* [DOCS-11726] Add tabs for US1-FED account types * [DOCS-11726] Remove duplicate config
1 parent 5e6a3a8 commit 4970f73

File tree

1 file changed

+89
-3
lines changed

1 file changed

+89
-3
lines changed

content/en/integrations/guide/aws-terraform-setup.md

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,19 +277,21 @@ resource "datadog_integration_aws_account" "datadog_integration" {
277277
{{< /site-region >}}
278278

279279
{{< site-region region="gov" >}}
280-
2. Set up your Terraform configuration file using the example below as a base template. Ensure to update the following parameters before you apply the changes:
280+
2. Select the tab for your AWS account type, and then use the example below as a base template to set up your Terraform configuration file. Ensure to update the following parameters before you apply the changes:
281281
* `AWS_PERMISSIONS_LIST`: The IAM policies needed by Datadog AWS integrations. The current list is available in the [Datadog AWS integration][1] documentation.
282282
* `AWS_ACCOUNT_ID`: Your AWS account ID.
283283

284-
See the [Terraform Registry][2] for further example usage and the full list of optional parameters, as well as additional Datadog resources.
284+
{{< tabs >}}
285+
286+
{{% tab "AWS Commercial Cloud" %}}
285287

286288
```hcl
287289
data "aws_iam_policy_document" "datadog_aws_integration_assume_role" {
288290
statement {
289291
actions = ["sts:AssumeRole"]
290292
principals {
291293
type = "AWS"
292-
identifiers = ["arn:aws:iam::065115117704:root"]
294+
identifiers = ["arn:aws:iam::392588925713:root"]
293295
}
294296
condition {
295297
test = "StringEquals"
@@ -357,6 +359,90 @@ resource "datadog_integration_aws_account" "datadog_integration" {
357359
}
358360
```
359361

362+
{{% /tab %}}
363+
364+
{{% tab "AWS GovCloud" %}}
365+
366+
```hcl
367+
data "aws_iam_policy_document" "datadog_aws_integration_assume_role" {
368+
statement {
369+
actions = ["sts:AssumeRole"]
370+
principals {
371+
type = "AWS"
372+
identifiers = ["arn:aws:iam::065115117704:root"]
373+
}
374+
condition {
375+
test = "StringEquals"
376+
variable = "sts:ExternalId"
377+
values = [
378+
"${datadog_integration_aws_account.datadog_integration.auth_config.aws_auth_config_role.external_id}"
379+
]
380+
}
381+
}
382+
}
383+
384+
data "aws_iam_policy_document" "datadog_aws_integration" {
385+
statement {
386+
actions = [<AWS_PERMISSIONS_LIST>]
387+
resources = ["*"]
388+
}
389+
}
390+
391+
resource "aws_iam_policy" "datadog_aws_integration" {
392+
name = "DatadogAWSIntegrationPolicy"
393+
policy = data.aws_iam_policy_document.datadog_aws_integration.json
394+
}
395+
resource "aws_iam_role" "datadog_aws_integration" {
396+
name = "DatadogIntegrationRole"
397+
description = "Role for Datadog AWS Integration"
398+
assume_role_policy = data.aws_iam_policy_document.datadog_aws_integration_assume_role.json
399+
}
400+
resource "aws_iam_role_policy_attachment" "datadog_aws_integration" {
401+
role = aws_iam_role.datadog_aws_integration.name
402+
policy_arn = aws_iam_policy.datadog_aws_integration.arn
403+
}
404+
resource "aws_iam_role_policy_attachment" "datadog_aws_integration_security_audit" {
405+
role = aws_iam_role.datadog_aws_integration.name
406+
policy_arn = "arn:aws:iam::aws:policy/SecurityAudit"
407+
}
408+
409+
resource "datadog_integration_aws_account" "datadog_integration" {
410+
account_tags = []
411+
aws_account_id = "<ACCOUNT_ID>"
412+
aws_partition = "aws-us-gov"
413+
aws_regions {
414+
include_all = true
415+
}
416+
auth_config {
417+
aws_auth_config_role {
418+
role_name = "DatadogIntegrationRole"
419+
}
420+
}
421+
resources_config {
422+
cloud_security_posture_management_collection = false
423+
extended_collection = true
424+
}
425+
traces_config {
426+
xray_services {
427+
}
428+
}
429+
logs_config {
430+
lambda_forwarder {
431+
}
432+
}
433+
metrics_config {
434+
namespace_filters {
435+
}
436+
}
437+
}
438+
```
439+
440+
{{% /tab %}}
441+
442+
{{< /tabs >}}
443+
444+
See the [Terraform Registry][2] for further example usage and the full list of optional parameters, as well as additional Datadog resources.
445+
360446
<div class="alert alert-info"></a><strong>Note</strong>: By default, the above configuration doesn't include Cloud Security. To enable Cloud Security, under <code>resources_config</code>, set <code>cloud_security_posture_management_collection = true</code>.</div>
361447

362448
[1]: /integrations/amazon_web_services/?tab=manual#aws-iam-permissions

0 commit comments

Comments
 (0)