Skip to content

Commit 30b4a41

Browse files
committed
fix: 6764: solve merge conflict
1 parent 0378968 commit 30b4a41

File tree

8 files changed

+113
-61
lines changed

8 files changed

+113
-61
lines changed

.github/workflows/terraform_and_release.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,18 @@ jobs:
3333
- run: terraform validate
3434

3535
release:
36-
if: github.event_name == 'push'
37-
needs: terraform
38-
runs-on: ubuntu-latest
39-
40-
steps:
41-
- uses: actions/checkout@v2
42-
- name: Semantic Release
43-
id: semantic
44-
uses: cycjimmy/semantic-release-action@v2
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
with:
48-
semantic_version: 17
49-
extra_plugins: |
50-
@semantic-release/changelog
51-
@semantic-release/git
36+
if: github.event_name == 'push'
37+
needs: terraform
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v2
41+
- name: Semantic Release
42+
id: semantic
43+
uses: cycjimmy/semantic-release-action@v2
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
semantic_version: 19
48+
extra_plugins: |
49+
@semantic-release/changelog@6
50+
@semantic-release/git@10

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
# [3.0.0](https://github.com/scribd/terraform-aws-datadog/compare/v2.7.0...v3.0.0) (2022-04-05)
2+
3+
4+
* feat!: enable support for aws provider 4.0+ (#49) ([5bc98cb](https://github.com/scribd/terraform-aws-datadog/commit/5bc98cb56b7dd1b697f3bfa64251515d8e8ff61c)), closes [#49](https://github.com/scribd/terraform-aws-datadog/issues/49)
5+
6+
7+
### BREAKING CHANGES
8+
9+
* This release drops support for AWS provider <4.0
10+
11+
When updating to this version, the diff will show each of the new resources as needing to be created. However, each of the new aws_s3_bucket_* resources relies on S3 API calls that utilize a PUT action in order to modify the target S3 bucket. Because these API calls adhere to standard HTTP methods for REST APIs, they should handle situations where the target configuration already exists (as noted in the HTTP RFC). Given that this is the case, it's not strictly necessary to import any new aws_s3_bucket_* resources that are a one-to-one translation from previous versions of the AWS provider -- on the next terraform apply, they'll attempt the PUT, and update the state with the results as necessary.
12+
13+
# [2.7.0](https://github.com/scribd/terraform-aws-datadog/compare/v2.6.1...v2.7.0) (2022-03-07)
14+
15+
16+
### Features
17+
18+
* enable support for Datadog provider 3.x ([e42de0e](https://github.com/scribd/terraform-aws-datadog/commit/e42de0e3ee6217db29251630370244e25debed6b))
19+
20+
## [2.6.1](https://github.com/scribd/terraform-aws-datadog/compare/v2.6.0...v2.6.1) (2022-03-07)
21+
22+
23+
### Bug Fixes
24+
25+
* restrict aws provider to <4 for this major branch ([#47](https://github.com/scribd/terraform-aws-datadog/issues/47)) ([07de45a](https://github.com/scribd/terraform-aws-datadog/commit/07de45adb3ff85fc925a9066dc581248f151fb49))
26+
27+
# [2.6.0](https://github.com/scribd/terraform-aws-datadog/compare/v2.5.0...v2.6.0) (2022-01-19)
28+
29+
30+
### Bug Fixes
31+
32+
* explicitly specify the versions for semantic-release ([#42](https://github.com/scribd/terraform-aws-datadog/issues/42)) ([09bd8b9](https://github.com/scribd/terraform-aws-datadog/commit/09bd8b96d3b78c302756e8b05baa2589b71daa4a))
33+
34+
35+
### Features
36+
37+
* enable support for Terraform 1.1.3 ([#40](https://github.com/scribd/terraform-aws-datadog/issues/40)) ([51c5279](https://github.com/scribd/terraform-aws-datadog/commit/51c52792eed5f4b324420429677bbe9b10b0cef0))
38+
139
# [2.5.0](https://github.com/scribd/terraform-aws-datadog/compare/v2.4.0...v2.5.0) (2021-10-01)
240

341

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ Cloudwatch log sync are namspaced by module.
7272

7373
## Module Versions
7474

75-
Version 2.0.0 and greater require terraform version 0.13.x.
76-
Version 1.3.5 is the latest version that support terraform version 0.12.x.
75+
**Version 3.x.x** and greater require terraform version > 0.13.x and AWS provider > 4.0.0.
76+
**Version 2.x.x** and greater require terraform version > 0.13.x and AWS provider < 4.0.0.
77+
**Version 1.x.x** is the latest version that support terraform version 0.12.x and AWS provider < 4.0.0.
7778
When using this module, please be sure to [pin to a compatible version](https://www.terraform.io/docs/configuration/modules.html#module-versions).
7879

7980
## Examples

logs_monitoring.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resource aws_cloudformation_stack "datadog-forwarder" {
1+
resource "aws_cloudformation_stack" "datadog-forwarder" {
22
name = "${local.stack_prefix}datadog-forwarder"
33
capabilities = ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND"]
44
parameters = {
@@ -18,13 +18,13 @@ resource aws_cloudformation_stack "datadog-forwarder" {
1818
}
1919
}
2020

21-
resource aws_secretsmanager_secret "datadog_api_key" {
21+
resource "aws_secretsmanager_secret" "datadog_api_key" {
2222
name_prefix = "${local.stack_prefix}datadog-api-key"
2323
description = "Datadog API Key"
2424
tags = local.default_tags
2525
}
2626

27-
resource aws_secretsmanager_secret_version "datadog_api_key" {
27+
resource "aws_secretsmanager_secret_version" "datadog_api_key" {
2828
secret_id = aws_secretsmanager_secret.datadog_api_key.id
2929
secret_string = var.datadog_api_key
3030
}

logs_monitoring_cloudwatch_log.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resource "aws_cloudwatch_log_subscription_filter" "test_lambdafunction_logfilter
77
distribution = "Random"
88
}
99

10-
resource aws_lambda_permission "allow_cloudwatch_logs_to_call_dd_lambda_handler" {
10+
resource "aws_lambda_permission" "allow_cloudwatch_logs_to_call_dd_lambda_handler" {
1111
count = length(var.cloudwatch_log_groups)
1212
statement_id = "${replace(var.cloudwatch_log_groups[count.index], "/", "_")}-AllowExecutionFromCloudWatchLogs"
1313
action = "lambda:InvokeFunction"

logs_monitoring_elb.tf

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,48 +25,46 @@ locals {
2525
elb_logs_s3_bucket = "${var.elb_logs_bucket_prefix}-${var.namespace}-${var.env}-elb-logs"
2626
}
2727

28+
data aws_iam_policy_document "elb_logs" {
29+
statement {
30+
actions = [
31+
"s3:PutObject"
32+
]
33+
resources = [
34+
"arn:aws:s3:::${local.elb_logs_s3_bucket}/*",
35+
]
36+
principals {
37+
type = "AWS"
38+
identifiers = [data.aws_elb_service_account.main.arn]
39+
}
40+
effect = "Allow"
41+
}
42+
}
43+
2844
resource "aws_s3_bucket" "elb_logs" {
2945
count = var.create_elb_logs_bucket ? 1 : 0
3046
bucket = local.elb_logs_s3_bucket
31-
acl = "private"
32-
policy = <<POLICY
33-
{
34-
"Id": "Policy",
35-
"Version": "2012-10-17",
36-
"Statement": [
37-
{
38-
"Action": [
39-
"s3:PutObject"
40-
],
41-
"Effect": "Allow",
42-
"Resource": "arn:aws:s3:::${local.elb_logs_s3_bucket}/*",
43-
"Principal": {
44-
"AWS": [
45-
"${data.aws_elb_service_account.main.arn}"
46-
]
47-
}
48-
}
49-
]
5047
}
51-
POLICY
5248

53-
server_side_encryption_configuration {
54-
rule {
55-
apply_server_side_encryption_by_default {
56-
sse_algorithm = "AES256"
57-
}
58-
}
59-
}
49+
resource "aws_s3_bucket_policy" "elb_logs" {
50+
count = var.create_elb_logs_bucket ? 1 : 0
51+
bucket = aws_s3_bucket.elb_logs[0].id
52+
policy = data.aws_iam_policy_document.elb_logs.json
53+
}
6054

61-
lifecycle_rule {
62-
id = "log"
63-
enabled = true
55+
resource "aws_s3_bucket_acl" "elb_logs" {
56+
count = var.create_elb_logs_bucket ? 1 : 0
57+
bucket = aws_s3_bucket.elb_logs[0].id
58+
acl = "private"
59+
}
6460

65-
tags = {
66-
"rule" = "log"
67-
"autoclean" = "true"
68-
}
61+
resource "aws_s3_bucket_lifecycle_configuration" "elb_logs" {
62+
count = var.create_elb_logs_bucket ? 1 : 0
63+
bucket = aws_s3_bucket.elb_logs[0].id
6964

65+
# Remove old versions of images after 15 days
66+
rule {
67+
id = "log"
7068
transition {
7169
days = 30
7270
storage_class = "STANDARD_IA" # or "ONEZONE_IA"
@@ -80,6 +78,18 @@ POLICY
8078
expiration {
8179
days = 365 # store logs for one year
8280
}
81+
status = "Enabled"
82+
}
83+
}
84+
85+
resource "aws_s3_bucket_server_side_encryption_configuration" "elb_logs" {
86+
count = var.create_elb_logs_bucket ? 1 : 0
87+
bucket = aws_s3_bucket.elb_logs[0].id
88+
89+
rule {
90+
apply_server_side_encryption_by_default {
91+
sse_algorithm = "AES256"
92+
}
8393
}
8494

8595
lifecycle_rule {

main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ resource "aws_iam_policy" "datadog-core" {
5959
"cloudformation:DetectStack*",
6060
"cloudfront:GetDistributionConfig",
6161
"cloudfront:ListDistributions",
62+
"cloudtrail:LookupEvents",
6263
"cloudtrail:DescribeTrails",
6364
"cloudtrail:GetTrailStatus",
64-
"cloudtrail:LookupEvents",
65-
"cloudwatch:ListMetrics",
6665
"cloudwatch:Describe*",
6766
"cloudwatch:Get*",
6867
"cloudwatch:List*",
@@ -119,9 +118,9 @@ resource "aws_iam_policy" "datadog-core" {
119118
"ses:Get*",
120119
"sns:List*",
121120
"sns:Publish",
122-
"sqs:ListQueues",
123121
"states:ListStateMachines",
124122
"states:DescribeStateMachine",
123+
"sqs:ListQueues",
125124
"support:*",
126125
"tag:GetResources",
127126
"tag:GetTagKeys",

versions.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
terraform {
2-
required_version = ">= 0.13, < 1.1.0"
2+
required_version = ">= 0.13, < 1.3.0"
33

44
required_providers {
55
datadog = {
66
source = "DataDog/datadog"
7-
version = ">= 2.10, < 3"
7+
version = ">= 2.10, < 4"
8+
}
9+
10+
aws = {
11+
source = "hashicorp/aws"
12+
version = ">= 4.0"
813
}
914
}
1015
}

0 commit comments

Comments
 (0)