Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove validation with supported AWS namespaces in metric_stats_to_sync #400

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions signalfx/resource_signalfx_aws_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,9 @@ func integrationAWSResource() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"namespace": &schema.Schema{
Type: schema.TypeString,
Required: true,
ValidateFunc: validateAwsService,
Description: "An AWS namespace having AWS metric that you want to pick statistics for",
Type: schema.TypeString,
Required: true,
Description: "An AWS namespace having AWS metric that you want to pick statistics for",
},
"metric": &schema.Schema{
Type: schema.TypeString,
Expand Down
24 changes: 22 additions & 2 deletions signalfx/resource_signalfx_aws_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ const newIntegrationAWSConfig = `
metric = "NetworkPacketsIn"
stats = ["p95", "p99"]
}

metric_stats_to_sync {
namespace = "AWS/SomeCustomNamespace"
metric = "TaskInstanceDuration"
stats = ["sum"]
}
}

resource "signalfx_aws_token_integration" "aws_tok_myteamXX" {
Expand Down Expand Up @@ -128,6 +134,12 @@ const updatedIntegrationAWSConfig = `
metric = "NetworkPacketsIn"
stats = ["upper"]
}

metric_stats_to_sync {
namespace = "AWS/SomeCustomNamespace"
metric = "TaskInstanceFailures"
stats = ["sum"]
}
}

resource "signalfx_aws_token_integration" "aws_tok_myteamXX" {
Expand Down Expand Up @@ -218,12 +230,16 @@ func TestAccCreateUpdateIntegrationAWS(t *testing.T) {
Config: newIntegrationAWSConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckIntegrationAWSResourceExists,
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.#", "1"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.#", "2"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.2980759070.namespace", "AWS/EC2"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.2980759070.metric", "NetworkPacketsIn"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.2980759070.stats.#", "2"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.2980759070.stats.1929087501", "p95"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.2980759070.stats.3729704193", "p99"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.529658192.namespace", "AWS/SomeCustomNamespace"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.529658192.metric", "TaskInstanceDuration"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.529658192.stats.#", "1"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.529658192.stats.1806468635", "sum"),
),
},
// Update
Expand All @@ -233,11 +249,15 @@ func TestAccCreateUpdateIntegrationAWS(t *testing.T) {
testAccCheckIntegrationAWSResourceExists,
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "name", "AWS TF Test (ext/updated)"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteam_tokXX", "name", "AWS TF Test (token/updated)"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.#", "1"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.#", "2"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.3877068524.namespace", "AWS/EC2"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.3877068524.metric", "NetworkPacketsIn"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.3877068524.stats.#", "1"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.3877068524.stats.2598274585", "upper"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.997089140.namespace", "AWS/SomeCustomNamespace"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.997089140.metric", "TaskInstanceFailures"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.997089140.stats.#", "1"),
resource.TestCheckResourceAttr("signalfx_aws_integration.aws_myteamXX", "metric_stats_to_sync.997089140.stats.1806468635", "sum"),
),
},
// Update again to enable Cloudwatch Metric Streams synchronization
Expand Down