Skip to content

Commit

Permalink
chore: discard hardcoded account ids
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-new-relic committed Oct 27, 2023
1 parent 7c092a0 commit 28cd432
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 121 deletions.
14 changes: 8 additions & 6 deletions newrelic/data_source_newrelic_entity_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

var alternateSubAccountID = 3957524

func TestAccNewRelicEntityData_Basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
Expand Down Expand Up @@ -90,9 +92,9 @@ func TestAccNewRelicEntityData_EntityInSubAccount(t *testing.T) {
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccNewRelicEntityDataConfig_EntityInSubAccount("Dummy App Two", 3957524),
Config: testAccNewRelicEntityDataConfig_EntityInSubAccount("Dummy App Two", alternateSubAccountID),
Check: resource.ComposeTestCheckFunc(
testAccCheckNewRelicEntityDataExists(t, "data.newrelic_entity.entity", "Dummy App Two", 3957524),
testAccCheckNewRelicEntityDataExists(t, "data.newrelic_entity.entity", "Dummy App Two", alternateSubAccountID),
),
},
},
Expand All @@ -107,7 +109,7 @@ func TestAccNewRelicEntityData_EntityAbsentInSubAccount(t *testing.T) {
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccNewRelicEntityDataConfig_EntityInSubAccount("Dummy App Two", 3814156),
Config: testAccNewRelicEntityDataConfig_EntityInSubAccount("Dummy App Two", testSubAccountID),
ExpectError: regexp.MustCompile(`no entities found`),
},
},
Expand All @@ -122,9 +124,9 @@ func TestAccNewRelicEntityData_RetrieveSubAccountEntity(t *testing.T) {
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccNewRelicEntityDataConfig_RetrieveSubAccountEntity("Dummy App Two", 3957524),
Config: testAccNewRelicEntityDataConfig_RetrieveSubAccountEntity("Dummy App Two", alternateSubAccountID),
Check: resource.ComposeTestCheckFunc(
testAccCheckNewRelicEntityDataExists(t, "data.newrelic_entity.entity", "Dummy App Two", 3957524),
testAccCheckNewRelicEntityDataExists(t, "data.newrelic_entity.entity", "Dummy App Two", alternateSubAccountID),
),
},
},
Expand All @@ -139,7 +141,7 @@ func TestAccNewRelicEntityData_RetrieveAbsentSubAccountEntity(t *testing.T) {
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccNewRelicEntityDataConfig_RetrieveSubAccountEntity("Dummy App Two", 3814156),
Config: testAccNewRelicEntityDataConfig_RetrieveSubAccountEntity("Dummy App Two", testSubAccountID),
ExpectError: regexp.MustCompile(`no entities found`),
},
},
Expand Down
2 changes: 1 addition & 1 deletion newrelic/resource_newrelic_one_dashboard_raw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func testAccCheckNewRelicOneDashboardRawConfig_PageFull(pageName string, account
]
}
)
linked_entity_guids = ["MzI5ODAxNnxWSVp8REFTSEJPQVJEfDI2MTcxNDc"]
linked_entity_guids = ["MzgwNjUyNnxWSVp8REFTSEJPQVJEfGRhOjI5Mjk0MjA"]
}
}
`
Expand Down
6 changes: 3 additions & 3 deletions newrelic/resource_newrelic_one_dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestAccNewRelicOneDashboard_CrossAccountQueries(t *testing.T) {
Steps: []resource.TestStep{
// Test: Create
{
Config: testAccCheckNewRelicOneDashboardConfig_TwoPageBasic(rName, "3814156"), // Hard-coded accountID for NRQL queries
Config: testAccCheckNewRelicOneDashboardConfig_TwoPageBasic(rName, strconv.Itoa(testSubAccountID)), // Hard-coded accountID for NRQL queries
Check: resource.ComposeTestCheckFunc(
testAccCheckNewRelicOneDashboardExists("newrelic_one_dashboard.bar", 0),
),
Expand Down Expand Up @@ -792,7 +792,7 @@ func testAccCheckNewRelicOneDashboardConfig_VariableNRQL() string {
}
name = "variable"
nrql_query {
account_ids = [3806526]
account_ids = [` + strconv.Itoa(testAccountID) + `]
query = "FROM Transaction SELECT average(duration) FACET appName"
}
replacement_strategy = "default"
Expand All @@ -813,7 +813,7 @@ func testAccCheckNewRelicOneDashboardConfig_VariableNRQLUpdated() string {
}
name = "variableUpdated"
nrql_query {
account_ids = [3806526, 3814156]
account_ids = [` + strconv.Itoa(testAccountID) + `,` + strconv.Itoa(testSubAccountID) + `]
query = "FROM Transaction SELECT average(duration) FACET appName"
}
replacement_strategy = "default"
Expand Down
222 changes: 111 additions & 111 deletions website/docs/r/cloud_aws_govcloud_integrations.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,139 +22,139 @@ To pull data from AWSGovCloud, complete the [steps outlined here](https://docs.n
## Example Usage

```hcl
resource "newrelic_cloud_awsGovcloud_link_account" "account" {
access_key_id ="%[1]s"
aws_account_id="%[2]s"
resource "newrelic_cloud_aws_govcloud_link_account" "account" {
access_key_id = "%[1]s"
aws_account_id = "%[2]s"
metric_collection_mode = "PULL"
name = "%[4]s"
secret_access_key = "%[3]s"
name = "%[4]s"
secret_access_key = "%[3]s"
}
resource "newrelic_cloud_aws_govcloud_integrations" "foo" {
account_id=3806526
linked_account_id=newrelic_cloud_awsGovcloud_link_account.account.id
alb{
metrics_polling_interval=1000
aws_regions=["us-east-1"]
fetch_extended_inventory=true
fetch_tags=true
load_balancer_prefixes=[""]
tag_key=""
tag_value=""
account_id = 1234321
linked_account_id = newrelic_cloud_awsGovcloud_link_account.account.id
alb {
metrics_polling_interval = 1000
aws_regions = ["us-east-1"]
fetch_extended_inventory = true
fetch_tags = true
load_balancer_prefixes = [""]
tag_key = ""
tag_value = ""
}
api_gateway{
metrics_polling_interval=1000
aws_regions=[""]
stage_prefixes=[""]
tag_key=""
tag_value=""
api_gateway {
metrics_polling_interval = 1000
aws_regions = [""]
stage_prefixes = [""]
tag_key = ""
tag_value = ""
}
auto_scaling{
metrics_polling_interval=1000
aws_regions=[""]
auto_scaling {
metrics_polling_interval = 1000
aws_regions = [""]
}
aws_direct_connect{
metrics_polling_interval=1000
aws_regions=[""]
aws_direct_connect {
metrics_polling_interval = 1000
aws_regions = [""]
}
aws_states{
metrics_polling_interval=1000
aws_regions=[""]
aws_states {
metrics_polling_interval = 1000
aws_regions = [""]
}
cloudtrail{
metrics_polling_interval=1000
aws_regions=[""]
cloudtrail {
metrics_polling_interval = 1000
aws_regions = [""]
}
dynamo_db{
metrics_polling_interval=1000
aws_regions=[""]
fetch_extended_inventory=true
fetch_tags=true
tag_key=""
tag_value=""
dynamo_db {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_extended_inventory = true
fetch_tags = true
tag_key = ""
tag_value = ""
}
ebs{
metrics_polling_interval=1000
aws_regions=[""]
fetch_extended_inventory=true
tag_key=""
tag_value=""
ebs {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_extended_inventory = true
tag_key = ""
tag_value = ""
}
ec2{
metrics_polling_interval=1000
aws_regions=[""]
fetch_ip_addresses=true
tag_key=""
tag_value=""
ec2 {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_ip_addresses = true
tag_key = ""
tag_value = ""
}
elastic_search{
metrics_polling_interval=1000
aws_regions=[""]
fetch_nodes=true
tag_key=""
tag_value=""
elastic_search {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_nodes = true
tag_key = ""
tag_value = ""
}
elb{
metrics_polling_interval=1000
aws_regions=[""]
fetch_extended_inventory=true
fetch_tags=true
elb {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_extended_inventory = true
fetch_tags = true
}
emr{
metrics_polling_interval=1000
aws_regions=[""]
fetch_tags=true
tag_key=""
tag_value=""
emr {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_tags = true
tag_key = ""
tag_value = ""
}
iam{
metrics_polling_interval=1000
tag_key=""
tag_value=""
iam {
metrics_polling_interval = 1000
tag_key = ""
tag_value = ""
}
lambda{
metrics_polling_interval=1000
aws_regions=[""]
fetch_tags=true
tag_key=""
tag_value=""
lambda {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_tags = true
tag_key = ""
tag_value = ""
}
rds{
metrics_polling_interval=1000
aws_regions=[""]
fetch_tags=true
tag_key=""
tag_value=""
rds {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_tags = true
tag_key = ""
tag_value = ""
}
red_shift{
metrics_polling_interval=1000
aws_regions=[""]
tag_key=""
tag_value=""
red_shift {
metrics_polling_interval = 1000
aws_regions = [""]
tag_key = ""
tag_value = ""
}
route53{
metrics_polling_interval=1000
fetch_extended_inventory=true
route53 {
metrics_polling_interval = 1000
fetch_extended_inventory = true
}
s3{
metrics_polling_interval=1000
fetch_extended_inventory=true
fetch_tags=true
tag_key=""
tag_value=""
s3 {
metrics_polling_interval = 1000
fetch_extended_inventory = true
fetch_tags = true
tag_key = ""
tag_value = ""
}
sns{
metrics_polling_interval=1000
aws_regions=[""]
fetch_extended_inventory=true
sns {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_extended_inventory = true
}
sqs{
metrics_polling_interval=1000
aws_regions=[""]
fetch_extended_inventory=true
fetch_tags=true
queue_prefixes=[""]
tag_key=""
tag_value=""
sqs {
metrics_polling_interval = 1000
aws_regions = [""]
fetch_extended_inventory = true
fetch_tags = true
queue_prefixes = [""]
tag_key = ""
tag_value = ""
}
}
```
Expand Down

0 comments on commit 28cd432

Please sign in to comment.