|
| 1 | +# terraform-aws-datadog |
| 2 | + |
| 3 | +Terraform module which sets up various AWS / Datadog integrations including: |
| 4 | + |
| 5 | +- Configure Datadog's builtin AWS integration |
| 6 | +- Configure Cloudtrail logshipping |
| 7 | +- Create ELB S3 bucket for logs and logshipping |
| 8 | +- Sync Cloudwatch logs for a given list of log groups |
| 9 | + |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +**Set up all supported AWS / Datadog integrations** |
| 14 | + |
| 15 | +``` |
| 16 | +module "datadog" { |
| 17 | + source = "git::https://github.com/scribd/terraform-aws-datadog.git?ref=master" |
| 18 | + aws_account_id = data.aws_caller_identity.current.account_id |
| 19 | + datadog_api_key = var.datadog_api_key |
| 20 | +
|
| 21 | + cloudtrail_bucket_id = aws_s3_bucket.org-cloudtrail-bucket.id |
| 22 | + cloudtrail_bucket_arn = aws_s3_bucket.org-cloudtrail-bucket.arn |
| 23 | +
|
| 24 | + cloudwatch_log_groups = ["cloudwatch_log_group_1", "cloudwatch_log_group_2"] |
| 25 | +} |
| 26 | +``` |
| 27 | + |
| 28 | +Note: The full integration setup should only be done within one terraform stack |
| 29 | +per account since some of the resources it creates are global per account. |
| 30 | +Creating this module in multiple terraform stacks will cause conflicts. |
| 31 | + |
| 32 | + |
| 33 | +**Limit to only Cloudwatch log sync** |
| 34 | + |
| 35 | +``` |
| 36 | +module "datadog" { |
| 37 | + source = "git::https://github.com/scribd/terraform-aws-datadog.git?ref=master" |
| 38 | + datadog_api_key = var.datadog_api_key |
| 39 | + create_elb_logs_bucket = false |
| 40 | + enable_datadog_aws_integration = false |
| 41 | + cloudwatch_log_groups = ["cloudwatch_log_group_1", "cloudwatch_log_group_2"] |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +Note: It is safe to create multiple Cloudwatch only modules across different |
| 46 | +Terraform stacks within a single AWS account since all resouces used for |
| 47 | +Cloudwatch log sync are namspaced by module. |
| 48 | + |
| 49 | + |
| 50 | +## Examples |
| 51 | + |
| 52 | +* [Full AWS Datadog integration](https://github.com/scribd/terraform-aws-datadog/tree/master/examples/full_integration) |
| 53 | +* [Cloudwatch log sync only](https://github.com/scribd/terraform-aws-datadog/tree/master/examples/cloudwatch_log_sync) |
| 54 | + |
| 55 | + |
| 56 | +## Development |
| 57 | + |
| 58 | +Releases are cut using [go-semrel-gitlab](https://gitlab.com/juhani/go-semrel-gitlab) |
| 59 | + |
| 60 | +Format commit messages using [Conventional Commits format](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) to determine the next version bump and to produce release notes |
| 61 | + |
| 62 | +``` |
| 63 | +type(scope): subject |
| 64 | +``` |
| 65 | +or |
| 66 | + |
| 67 | +``` |
| 68 | +type: subject |
| 69 | +``` |
| 70 | + |
| 71 | +Types: |
| 72 | +``` |
| 73 | +minor bump: feat |
| 74 | +patch bump: fix,refactor,perf,docs,style,tes |
| 75 | +``` |
| 76 | + |
| 77 | +When a commit contains a breaking change, the commit message should contain `BREAKING CHANGE:` |
| 78 | + |
| 79 | + |
| 80 | +## Cutting a release |
| 81 | + |
| 82 | +### Maintainers |
| 83 | +- [Jim](https://github.com/jim80net) |
| 84 | +- [QP](https://github.com/houqp) |
| 85 | + |
| 86 | +## Troubleshooting |
| 87 | + |
| 88 | +If you should encounter `Datadog is not authorized to perform action sts:AssumeRole Accounts affected: 1234567890, 1234567891 Regions affected: every region Errors began reporting 18m ago, last seen 5m ago` |
| 89 | +Then perhaps the external ID has changed. Execute `./terraform taint module.datadog.datadog_integration_aws.core[0]` in the root module of the account repo to force a refresh. |
0 commit comments