Skip to content

Commit

Permalink
refactor: undo changes made to the original aws module
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-new-relic committed Jan 30, 2025
1 parent c920008 commit c705436
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
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 = [266471868085]
identifiers = [var.new_relic_aws_govcloud_account_id]
}

condition {
Expand Down Expand Up @@ -74,7 +74,7 @@ resource "newrelic_cloud_aws_govcloud_link_account" "newrelic_cloud_integration_
depends_on = [aws_iam_role_policy_attachment.newrelic_aws_policy_attach]
access_key_id = newrelic_api_access_key.newrelic_aws_access_key.key
secret_access_key = newrelic_api_access_key.newrelic_aws_access_key.key
aws_account_id = "266471868085"
aws_account_id = var.new_relic_aws_govcloud_account_id
}

resource "newrelic_api_access_key" "newrelic_aws_access_key" {
Expand Down Expand Up @@ -220,7 +220,7 @@ resource "newrelic_cloud_aws_govcloud_link_account" "newrelic_cloud_integration_
depends_on = [aws_iam_role_policy_attachment.newrelic_aws_policy_attach]
access_key_id = newrelic_api_access_key.newrelic_aws_access_key.key
secret_access_key = newrelic_api_access_key.newrelic_aws_access_key.key
aws_account_id = "266471868085"
aws_account_id = var.new_relic_aws_govcloud_account_id
}

resource "newrelic_cloud_aws_govcloud_integrations" "newrelic_cloud_integration_pull" {
Expand All @@ -235,7 +235,7 @@ resource "newrelic_cloud_aws_govcloud_integrations" "newrelic_cloud_integration_
auto_scaling {}
aws_direct_connect {}
aws_states {}
dynamo_db {}
dynamo_db {}
ec2 {}
elastic_search {}
elb {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ variable "include_metric_filters" {
type = map(list(string))
default = {}
}

variable "new_relic_aws_govcloud_account_id" {
type = string
default = "266471868085"
}
3 changes: 1 addition & 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 = var.newrelic_account_region == "US_GOV" ? [266471868085] : [754728514883]
identifiers = [754728514883]
}

condition {
Expand Down Expand Up @@ -125,7 +125,6 @@ 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"
}
}

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", "US_GOV"], var.newrelic_account_region)
condition = contains(["US", "EU"], var.newrelic_account_region)
error_message = "Valid values for region are 'US' or 'EU'."
}
}
Expand Down

0 comments on commit c705436

Please sign in to comment.