Skip to content

Commit b6c94af

Browse files
authored
Add wildcard support and email mapping for AWS cloud authentication (#33393)
- Add documentation for wildcard support in ARN patterns - Update service account mapping to support both UUID and email address - Add link to AWS IAM role creation documentation
1 parent d2a9a42 commit b6c94af

File tree

1 file changed

+61
-4
lines changed

1 file changed

+61
-4
lines changed

content/en/account_management/cloud_provider_authentication.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Setting up cloud-provider based authentication for AWS involves two parts:
5757

5858
First, map your AWS identities (ARNs) to Datadog service accounts or user accounts. During the preview, you must perform the mapping using the Datadog API.
5959

60+
If you need to create IAM roles in AWS, see the [AWS IAM role creation documentation][5].
61+
6062
#### Map an AWS ARN to a Datadog user account
6163
For `account_identifier`, use the email shown in the user's Datadog profile.
6264

@@ -80,12 +82,14 @@ curl -X POST "{{< region-param key=dd_api code="true" >}}/api/v2/cloud_auth/aws/
8082
```
8183

8284
#### Map an AWS ARN to a Datadog service account
83-
To get a service account's `account_identifier`, go to **Organization settings > Service accounts**, click the service account you want to map, and copy the `service_account_id` from the URL. For example, if the URL ends in `/organization-settings/service-accounts?service_account_id=3fa85f64-5717-4562-b3fc-2c963f66afa6`, then use `3fa85f64-5717-4562-b3fc-2c963f66afa6` as an account identifier for your service account.
85+
For `account_identifier`, you can use either:
86+
- The service account's **UUID**: Go to **Organization settings > Service accounts**, click the service account you want to map, and copy the `service_account_id` from the URL. For example, if the URL ends in `/organization-settings/service-accounts?service_account_id=3fa85f64-5717-4562-b3fc-2c963f66afa6`, then use `3fa85f64-5717-4562-b3fc-2c963f66afa6`.
87+
- The service account's **email address**: Use the email address shown in the service account's details.
8488

85-
**Example**: An API call that maps an AWS ARN to a Datadog service account, `3fa85f64-5717-4562-b3fc-2c963f66afa6`.
89+
**Example**: An API call that maps an AWS ARN to a Datadog service account using the UUID, `3fa85f64-5717-4562-b3fc-2c963f66afa6`.
8690

8791
```bash
88-
# Example: map an AWS ARN to a Datadog Service Account
92+
# Example: map an AWS ARN to a Datadog Service Account using UUID
8993
curl -X POST "{{< region-param key=dd_api code="true" >}}/api/v2/cloud_auth/aws/persona_mapping" \
9094
-H "Content-Type: application/json" \
9195
-H "DD-API-KEY: ${DD_API_KEY}" \
@@ -101,6 +105,58 @@ curl -X POST "{{< region-param key=dd_api code="true" >}}/api/v2/cloud_auth/aws/
101105
}'
102106
```
103107

108+
**Example**: An API call that maps an AWS ARN to a Datadog service account using the email address, `[email protected]`.
109+
110+
```bash
111+
# Example: map an AWS ARN to a Datadog Service Account using email
112+
curl -X POST "{{< region-param key=dd_api code="true" >}}/api/v2/cloud_auth/aws/persona_mapping" \
113+
-H "Content-Type: application/json" \
114+
-H "DD-API-KEY: ${DD_API_KEY}" \
115+
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
116+
-d '{
117+
"data": {
118+
"type": "aws_cloud_auth_config",
119+
"attributes": {
120+
"account_identifier": "[email protected]",
121+
"arn_pattern": "arn:aws:sts::123456789012:assumed-role/terraform-runner"
122+
}
123+
}
124+
}'
125+
```
126+
127+
#### Using wildcards in ARN patterns
128+
129+
ARN patterns support wildcard matching to handle dynamic or variable portions of resource ARNs. This is useful when working with assumed roles that include session identifiers or other variable components.
130+
131+
**Wildcard rules**:
132+
- Wildcards (`*`) are only allowed in the last portion of the resource ARN
133+
- You must specify a specific resource before the wildcard
134+
- Wildcards cannot be placed in the middle of the ARN
135+
136+
**Example**: Match any session assuming the `DatadogTerraformerRole`:
137+
138+
```bash
139+
curl -X POST "{{< region-param key=dd_api code="true" >}}/api/v2/cloud_auth/aws/persona_mapping" \
140+
-H "Content-Type: application/json" \
141+
-H "DD-API-KEY: ${DD_API_KEY}" \
142+
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
143+
-d '{
144+
"data": {
145+
"type": "aws_cloud_auth_config",
146+
"attributes": {
147+
"account_identifier": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
148+
"arn_pattern": "arn:aws:sts::123456789012:assumed-role/DatadogTerraformerRole/*"
149+
}
150+
}
151+
}'
152+
```
153+
154+
This pattern matches actual assumed role ARNs like:
155+
- `arn:aws:sts::123456789012:assumed-role/DatadogTerraformerRole/run-abcdefghijk`
156+
- `arn:aws:sts::123456789012:assumed-role/DatadogTerraformerRole/session-xyz789`
157+
158+
<div class="alert alert-info">Wildcard matching is particularly useful for CI/CD pipelines where role sessions have dynamically generated identifiers.</div>
159+
104160
#### List existing mappings
105161

106162
```bash
@@ -157,4 +213,5 @@ The Terraform provider automatically uses your configured AWS credentials to aut
157213
[1]: https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html
158214
[2]: https://app.datadoghq.com/api/v2/current_user
159215
[3]: /integrations/amazon-web-services/
160-
[4]: https://app.datadoghq.com/integrations/amazon-web-services
216+
[4]: https://app.datadoghq.com/integrations/amazon-web-services
217+
[5]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create.html

0 commit comments

Comments
 (0)