Skip to content

Commit

Permalink
chore(aws): added condition support for US GOV cloud (#2801)
Browse files Browse the repository at this point in the history
chore(aws): added condition support for US GOV cloud (#2801)
  • Loading branch information
vinay-newrelic authored Jan 30, 2025
1 parent b610f48 commit 2acea21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions examples/modules/cloud-integrations/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data "aws_iam_policy_document" "newrelic_assume_policy" {
principals {
type = "AWS"
// This is the unique identifier for New Relic account on AWS, there is no need to change this
identifiers = [754728514883]
identifiers = var.newrelic_account_region == "US_GOV" ? [266471868085] : [754728514883]
}

condition {
Expand Down Expand Up @@ -121,11 +121,19 @@ resource "aws_s3_bucket_ownership_controls" "newrelic_ownership_controls" {
}
}

locals {
newrelic_urls = {
US = "https://aws-api.newrelic.com/cloudwatch-metrics/v1"
EU = "https://aws-api.eu01.nr-data.net/cloudwatch-metrics/v1"
US_GOV = "https://gov-aws-api.newrelic.com/cloudwatch-metrics/v1"
}
}

resource "aws_kinesis_firehose_delivery_stream" "newrelic_firehose_stream" {
name = "newrelic_firehose_stream_${var.name}"
destination = "http_endpoint"
http_endpoint_configuration {
url = var.newrelic_account_region == "US" ? "https://aws-api.newrelic.com/cloudwatch-metrics/v1" : "https://aws-api.eu01.nr-data.net/cloudwatch-metrics/v1"
url = local.newrelic_urls[var.newrelic_account_region]
name = "New Relic ${var.name}"
access_key = newrelic_api_access_key.newrelic_aws_access_key.key
buffering_size = 1
Expand Down
2 changes: 1 addition & 1 deletion examples/modules/cloud-integrations/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ variable "newrelic_account_region" {
default = "US"

validation {
condition = contains(["US", "EU"], var.newrelic_account_region)
condition = contains(["US", "EU", "US_GOV"], var.newrelic_account_region)
error_message = "Valid values for region are 'US' or 'EU'."
}
}
Expand Down

0 comments on commit 2acea21

Please sign in to comment.