|
| 1 | +# Component: `datadog-integration` |
| 2 | + |
| 3 | +This component is responsible for provisioning a DataDog <=> AWS integration. It's required that the DataDog API and App secret keys are available in the consuming account at the `var.datadog_api_secret_key` and `var.datadog_app_secret_key` paths in either AWS Secrets Manager or the AWS SSM Parameter Store. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +**Stack Level**: Global |
| 8 | + |
| 9 | +Here's an example snippet for how to use this component. It's suggested to apply this component to all accounts which you want to track AWS metrics with DataDog. |
| 10 | + |
| 11 | +```yaml |
| 12 | +components: |
| 13 | + terraform: |
| 14 | + datadog-integration: |
| 15 | + vars: |
| 16 | + integrations: |
| 17 | + - "all" |
| 18 | + secrets_store_type: ASM # AWS Secrets Manager |
| 19 | + host_tags: |
| 20 | + - env:uw2-demo |
| 21 | + - region:us-west-2 |
| 22 | + - stage:demo |
| 23 | +``` |
| 24 | +
|
| 25 | +<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
| 26 | +## Requirements |
| 27 | +
|
| 28 | +| Name | Version | |
| 29 | +|------|---------| |
| 30 | +| terraform | >= 0.12 | |
| 31 | +| aws | >= 2.0 | |
| 32 | +| datadog | >= 2.15.0 | |
| 33 | +| local | >= 1.3 | |
| 34 | +| template | >= 2.0 | |
| 35 | +
|
| 36 | +## Providers |
| 37 | +
|
| 38 | +| Name | Version | |
| 39 | +|------|---------| |
| 40 | +| aws | >= 2.0 | |
| 41 | +
|
| 42 | +## Inputs |
| 43 | +
|
| 44 | +| Name | Description | Type | Default | Required | |
| 45 | +|------|-------------|------|---------|:--------:| |
| 46 | +| account\_specific\_namespace\_rules | An object, (in the form {"namespace1":true/false, "namespace2":true/false} ), that enables or disables metric collection for specific AWS namespaces for this AWS account only | `map(string)` | `{}` | no | |
| 47 | +| additional\_tag\_map | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no | |
| 48 | +| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no | |
| 49 | +| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | <pre>object({<br> enabled = bool<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> delimiter = string<br> attributes = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> label_order = list(string)<br> id_length_limit = number<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_order": [],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no | |
| 50 | +| datadog\_aws\_account\_id | The AWS account ID Datadog's integration servers use for all integrations | `string` | `"464622532012"` | no | |
| 51 | +| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | |
| 52 | +| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no | |
| 53 | +| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | |
| 54 | +| excluded\_regions | An array of AWS regions to exclude from metrics collection | `list(string)` | `[]` | no | |
| 55 | +| filter\_tags | An array of EC2 tags (in the form `key:value`) that defines a filter that Datadog use when collecting metrics from EC2. Wildcards, such as ? (for single characters) and \* (for multiple characters) can also be used | `list(string)` | `null` | no | |
| 56 | +| host\_tags | An array of tags (in the form `key:value`) to add to all hosts and metrics reporting through this integration | `list(string)` | `[]` | no | |
| 57 | +| id\_length\_limit | Limit `id` to this many characters.<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no | |
| 58 | +| import\_role\_arn | IAM Role ARN to use when importing a resource | `string` | `null` | no | |
| 59 | +| integrations | List of AWS permission names to apply for different integrations (e.g. 'all', 'core') | `list(string)` | <pre>[<br> "all"<br>]</pre> | no | |
| 60 | +| label\_order | The naming order of the id output and Name tag.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no | |
| 61 | +| name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no | |
| 62 | +| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no | |
| 63 | +| regex\_replace\_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | |
| 64 | +| region | AWS Region | `string` | n/a | yes | |
| 65 | +| ssm\_parameter\_name\_format | SSM parameter name format | `string` | `"/%s/%s"` | no | |
| 66 | +| ssm\_path | SSM path | `string` | `"datadog"` | no | |
| 67 | +| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | |
| 68 | +| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no | |
| 69 | +| tfstate\_account\_id | The ID of the account where the Terraform remote state backend is provisioned | `string` | `""` | no | |
| 70 | +| tfstate\_assume\_role | Set to false to use the caller's role to access the Terraform remote state | `bool` | `true` | no | |
| 71 | +| tfstate\_bucket\_environment\_name | The name of the environment for Terraform state bucket | `string` | `""` | no | |
| 72 | +| tfstate\_bucket\_stage\_name | The name of the stage for Terraform state bucket | `string` | `"root"` | no | |
| 73 | +| tfstate\_existing\_role\_arn | The ARN of the existing IAM Role to access the Terraform remote state. If not provided and `remote_state_assume_role` is `true`, a role will be constructed from `remote_state_role_arn_template` | `string` | `""` | no | |
| 74 | +| tfstate\_role\_arn\_template | IAM Role ARN template for accessing the Terraform remote state | `string` | `"arn:aws:iam::%s:role/%s-%s-%s-%s"` | no | |
| 75 | +| tfstate\_role\_environment\_name | The name of the environment for Terraform state IAM role | `string` | `"gbl"` | no | |
| 76 | +| tfstate\_role\_name | IAM Role name for accessing the Terraform remote state | `string` | `"terraform"` | no | |
| 77 | +| tfstate\_role\_stage\_name | The name of the stage for Terraform state IAM role | `string` | `"root"` | no | |
| 78 | + |
| 79 | +## Outputs |
| 80 | + |
| 81 | +| Name | Description | |
| 82 | +|------|-------------| |
| 83 | +| aws\_account\_id | AWS Account ID of the IAM Role for the Datadog integration | |
| 84 | +| aws\_role\_name | Name of the AWS IAM Role for the Datadog integration | |
| 85 | +| datadog\_external\_id | Datadog integration external ID | |
| 86 | + |
| 87 | +<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
| 88 | + |
| 89 | + |
| 90 | +## References |
| 91 | +* [cloudposse/terraform-aws-components](https://github.com/cloudposse/terraform-aws-components/tree/master/modules/datadog-integration) - Cloud Posse's upstream component |
| 92 | + |
| 93 | + |
| 94 | +[<img src="https://cloudposse.com/logo-300x69.svg" height="32" align="right"/>](https://cpco.io/component) |
0 commit comments