-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update documentation and add example integration (#9)
- Loading branch information
Showing
6 changed files
with
110 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|:----:|:-----:|:-----:| | ||
| attributes | Additional attributes (e.g. `policy` or `role`) | list | `<list>` | no | | ||
| datadog_aws_account_id | Datadog’s AWS account ID | string | - | yes | | ||
| datadog_external_id | External Id of the DataDog service | string | - | yes | | ||
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no | | ||
| integrations | List of AWS Services to integration with the DataDog service (e.g EC2, RDS, Billing ...) | list | - | yes | | ||
| name | The Name of the application or solution (e.g. `bastion` or `portal`) | string | - | yes | | ||
| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no | | ||
| datadog_aws_account_id | The AWS account ID Datadog's integration servers use for all integrations | string | `464622532012` | no | | ||
| datadog_external_id | AWS External ID for this Datadog integration | string | - | yes | | ||
| integrations | List of AWS permission names to apply for different integrations (`all`, `core`, `rds`) | list | - | yes | | ||
| name | The Name of the application or solution (e.g. `bastion` or `portal`) | string | `datadog` | no | | ||
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes | | ||
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes | | ||
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')`) | map | `<map>` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| role | Name of AWS IAM Role associated with creating integration | | ||
| role | Name of the AWS IAM Role for Datadog to use for this integration | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
data "aws_iam_policy_document" "lambda" { | ||
statement { | ||
sid = "DatadogLambd" | ||
effect = "Allow" | ||
|
||
actions = [ | ||
"lambda:List*", | ||
"logs:DescribeLogGroups", | ||
"logs:DescribeLogStreams", | ||
"logs:FilterLogEvents", | ||
"tag:GetResources", | ||
] | ||
|
||
resources = ["*"] | ||
} | ||
} | ||
|
||
module "lambda_label" { | ||
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=0.6.2" | ||
namespace = "${var.namespace}" | ||
stage = "${var.stage}" | ||
name = "${var.name}" | ||
attributes = ["${compact(concat(var.attributes, list("lambda")))}"] | ||
} | ||
|
||
locals { | ||
lambda_count = "${contains(split(",", lower(join(",", var.integrations))), "lambda") ? 1 : 0}" | ||
} | ||
|
||
resource "aws_iam_policy" "lambda" { | ||
count = "${local.lambda_count}" | ||
name = "${module.lambda_label.id}" | ||
policy = "${data.aws_iam_policy_document.lambda.json}" | ||
} | ||
|
||
resource "aws_iam_role_policy_attachment" "lambda" { | ||
count = "${local.lambda_count}" | ||
role = "${aws_iam_role.default.name}" | ||
policy_arn = "${join("", aws_iam_policy.lambda.*.arn)}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
output "role" { | ||
value = "${aws_iam_role.default.name}" | ||
description = "Name of AWS IAM Role associated with creating integration" | ||
description = "Name of the AWS IAM Role for Datadog to use for this integration" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters