Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ben851 committed Jul 26, 2024
1 parent 3db6565 commit 5dadc6a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion aws/newrelic/alert_policies.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "newrelic_alert_policy" "terraform_notify_policy" {
count = var.enable_new_relic ? 1 : 0

name = "Notify Policy - ${var.env}"
provider = newrelic
}
Expand Down
32 changes: 16 additions & 16 deletions aws/newrelic/aws_integration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ resource "aws_iam_role" "newrelic_aws_role" {
}

resource "aws_iam_policy" "newrelic_aws_permissions" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
name = "NewRelicCloudStreamReadPermissions-${var.env}"
description = ""
policy = <<EOF
Expand Down Expand Up @@ -67,13 +67,13 @@ EOF
}

resource "aws_iam_role_policy_attachment" "newrelic_aws_policy_attach" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
role = aws_iam_role.newrelic_aws_role[0].name
policy_arn = "arn:aws:iam::aws:policy/ReadOnlyAccess"
}

resource "newrelic_cloud_aws_link_account" "newrelic_cloud_integration_push" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
account_id = var.new_relic_account_id
arn = aws_iam_role.newrelic_aws_role[0].arn
metric_collection_mode = "PUSH"
Expand All @@ -82,7 +82,7 @@ resource "newrelic_cloud_aws_link_account" "newrelic_cloud_integration_push" {
}

resource "newrelic_api_access_key" "newrelic_aws_access_key" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
account_id = var.new_relic_account_id
key_type = "INGEST"
ingest_type = "LICENSE"
Expand All @@ -91,7 +91,7 @@ resource "newrelic_api_access_key" "newrelic_aws_access_key" {
}

resource "aws_iam_role" "firehose_newrelic_role" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
name = "firehose_newrelic_role_${var.env}"

assume_role_policy = <<EOF
Expand All @@ -112,28 +112,28 @@ EOF
}

resource "random_string" "s3-bucket-name" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
length = 8
special = false
upper = false
}

resource "aws_s3_bucket" "newrelic_aws_bucket" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
bucket = "newrelic-aws-bucket-${random_string.s3-bucket-name[0].id}"
force_destroy = true
}

resource "aws_s3_bucket_ownership_controls" "newrelic_ownership_controls" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
bucket = aws_s3_bucket.newrelic_aws_bucket[0].id
rule {
object_ownership = "BucketOwnerEnforced"
}
}

resource "aws_kinesis_firehose_delivery_stream" "newrelic_firehose_stream" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
name = "newrelic_firehose_stream_${var.env}"
destination = "http_endpoint"
http_endpoint_configuration {
Expand All @@ -158,7 +158,7 @@ resource "aws_kinesis_firehose_delivery_stream" "newrelic_firehose_stream" {
}

resource "aws_iam_role" "metric_stream_to_firehose" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
name = "newrelic_metric_stream_to_firehose_role_${var.env}"

assume_role_policy = <<EOF
Expand All @@ -179,7 +179,7 @@ EOF
}

resource "aws_iam_role_policy" "metric_stream_to_firehose" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
name = "default"
role = aws_iam_role.metric_stream_to_firehose[0].id

Expand Down Expand Up @@ -210,7 +210,7 @@ resource "aws_cloudwatch_metric_stream" "newrelic_metric_stream" {
}

resource "newrelic_cloud_aws_link_account" "newrelic_cloud_integration_pull" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
account_id = var.new_relic_account_id
arn = aws_iam_role.newrelic_aws_role[0].arn
metric_collection_mode = "PULL"
Expand Down Expand Up @@ -278,7 +278,7 @@ resource "newrelic_cloud_aws_integrations" "newrelic_cloud_integration_pull" {
}

resource "aws_s3_bucket" "newrelic_configuration_recorder_s3" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
bucket = "newrelic-configuration-recorder-${random_string.s3-bucket-name[0].id}"
force_destroy = true
}
Expand All @@ -304,7 +304,7 @@ EOF
}

resource "aws_iam_role_policy" "newrelic_configuration_recorder_s3" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
name = "newrelic-configuration-recorder-s3-${var.env}"
role = aws_iam_role.newrelic_configuration_recorder[0].id

Expand All @@ -328,14 +328,14 @@ POLICY
}

resource "aws_iam_role_policy_attachment" "newrelic_configuration_recorder" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
role = aws_iam_role.newrelic_configuration_recorder[0].name
policy_arn = "arn:aws:iam::aws:policy/service-role/AWS_ConfigRole"
}


resource "aws_config_configuration_recorder_status" "newrelic_recorder_status" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
name = var.aws_config_recorder_name
is_enabled = true
}
2 changes: 1 addition & 1 deletion aws/newrelic/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data "newrelic_entity" "notification-admin" {

data "newrelic_entity" "notification-api-k8s" {
count = var.enable_new_relic ? 1 : 0

name = "notification-api-${var.env}"
provider = newrelic
}
6 changes: 3 additions & 3 deletions aws/newrelic/notifications.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "newrelic_notification_destination" "terraform_notify_destination" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0

account_id = var.new_relic_account_id
active = true
Expand All @@ -13,7 +13,7 @@ resource "newrelic_notification_destination" "terraform_notify_destination" {
}

resource "newrelic_notification_channel" "terraform_notify_channel" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0

name = "Notify Slack Channel - ${var.env}"
type = "SLACK_LEGACY"
Expand All @@ -28,7 +28,7 @@ resource "newrelic_notification_channel" "terraform_notify_channel" {
}

resource "newrelic_workflow" "terraform_notify_workflow" {
count = var.enable_new_relic && var.env == "staging" ? 1 : 0
count = var.enable_new_relic && var.env == "staging" ? 1 : 0

name = "Notify Workflow - ${var.env}"
account_id = var.new_relic_account_id
Expand Down

0 comments on commit 5dadc6a

Please sign in to comment.