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

feat(entity_tags): add an entity tag resource #679

Merged
merged 5 commits into from
Jun 17, 2020
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
2 changes: 1 addition & 1 deletion build/deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ deps: tools deps-only

deps-only:
@echo "=== $(PROJECT_NAME) === [ deps ]: Installing package dependencies required by the project..."
@$(GO) mod tidy
#@$(GO) mod tidy
sanderblue marked this conversation as resolved.
Show resolved Hide resolved
@$(GO) mod download

tools: check-version
Expand Down
2 changes: 1 addition & 1 deletion build/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MISSPELL ?= misspell

COMMIT_LINT_CMD ?= go-gitlint
COMMIT_LINT_REGEX ?= "(chore|docs|feat|fix|refactor|tests?)(\([^\)]+\))?: .*"
COMMIT_LINT_START ?= "2020-05-01"
COMMIT_LINT_START ?= "2020-06-17"


EXCLUDEDIR ?= .git
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ module github.com/terraform-providers/terraform-provider-newrelic
go 1.13

require (
github.com/Azure/go-autorest v14.0.1+incompatible // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 // indirect
github.com/bflad/tfproviderlint v0.14.0
github.com/client9/misspell v0.3.4
github.com/golangci/golangci-lint v1.27.0
github.com/hashicorp/terraform v0.12.26 // indirect
github.com/hashicorp/terraform-plugin-sdk v1.10.0
github.com/newrelic/go-agent/v3 v3.6.0
github.com/newrelic/go-insights v1.0.3
Expand Down
180 changes: 163 additions & 17 deletions go.sum

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions newrelic/data_source_newrelic_entity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package newrelic
import (
"fmt"
"testing"
"time"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
Expand All @@ -15,9 +14,6 @@ func TestAccNewRelicEntityData_Basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)

// We need to give the entity search engine time to index the app
time.Sleep(5 * time.Second)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
Expand Down
10 changes: 10 additions & 0 deletions newrelic/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,13 @@ func envAccountID() (interface{}, error) {

return nil, nil
}

func stringInSlice(slice []string, str string) bool {
for _, s := range slice {
if str == s {
return true
}
}

return false
}
13 changes: 7 additions & 6 deletions newrelic/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/hashicorp/terraform-plugin-sdk/httpclient"
"github.com/hashicorp/terraform-plugin-sdk/meta"
"github.com/hashicorp/terraform-plugin-sdk/terraform"

"github.com/terraform-providers/terraform-provider-newrelic/version"
Expand Down Expand Up @@ -129,18 +129,19 @@ func Provider() terraform.ResourceProvider {
ResourcesMap: map[string]*schema.Resource{
"newrelic_alert_channel": resourceNewRelicAlertChannel(),
"newrelic_alert_condition": resourceNewRelicAlertCondition(),
"newrelic_alert_policy_channel": resourceNewRelicAlertPolicyChannel(),
"newrelic_alert_policy": resourceNewRelicAlertPolicy(),
"newrelic_alert_policy_channel": resourceNewRelicAlertPolicyChannel(),
"newrelic_application_settings": resourceNewRelicApplicationSettings(),
"newrelic_plugins_alert_condition": resourceNewRelicPluginsAlertCondition(),
"newrelic_dashboard": resourceNewRelicDashboard(),
"newrelic_entity_tags": resourceNewRelicEntityTags(),
"newrelic_infra_alert_condition": resourceNewRelicInfraAlertCondition(),
"newrelic_insights_event": resourceNewRelicInsightsEvent(),
"newrelic_nrql_alert_condition": resourceNewRelicNrqlAlertCondition(),
"newrelic_plugins_alert_condition": resourceNewRelicPluginsAlertCondition(),
"newrelic_synthetics_alert_condition": resourceNewRelicSyntheticsAlertCondition(),
"newrelic_synthetics_label": resourceNewRelicSyntheticsLabel(),
"newrelic_synthetics_monitor": resourceNewRelicSyntheticsMonitor(),
"newrelic_synthetics_monitor_script": resourceNewRelicSyntheticsMonitorScript(),
"newrelic_synthetics_label": resourceNewRelicSyntheticsLabel(),
"newrelic_synthetics_secure_credential": resourceNewRelicSyntheticsSecureCredential(),
"newrelic_workload": resourceNewRelicWorkload(),
},
Expand All @@ -161,8 +162,8 @@ func Provider() terraform.ResourceProvider {
func providerConfigure(data *schema.ResourceData, terraformVersion string) (interface{}, error) {
adminAPIKey := data.Get("admin_api_key").(string)
personalAPIKey := data.Get("api_key").(string)
userAgent := fmt.Sprintf("%s %s/%s", httpclient.TerraformUserAgent(terraformVersion), TerraformProviderProductUserAgent, version.ProviderVersion)

terraformUA := fmt.Sprintf("HashiCorp Terraform/%s (+https://www.terraform.io) Terraform Plugin SDK/%s", terraformVersion, meta.SDKVersionString())
userAgent := fmt.Sprintf("%s %s/%s", terraformUA, TerraformProviderProductUserAgent, version.ProviderVersion)
accountID := data.Get("account_id").(int)

cfg := Config{
Expand Down
7 changes: 6 additions & 1 deletion newrelic/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ func TestAccNewRelicProvider_Region(t *testing.T) {
rName := acctest.RandString(5)

resource.ParallelTest(t, resource.TestCase{
Providers: testAccProviders,
Providers: testAccProviders,
CheckDestroy: func(*terraform.State) error { return nil },
Steps: []resource.TestStep{
// Test: Region "US"
{
Expand Down Expand Up @@ -131,6 +132,9 @@ func testAccPreCheck(t *testing.T) {

//testAccApplicationsCleanup(t)
testAccCreateApplication(t)

// We need to give the entity search engine time to index the app
time.Sleep(5 * time.Second)
}

func testAccCreateApplication(t *testing.T) {
Expand All @@ -148,6 +152,7 @@ func testAccCreateApplication(t *testing.T) {
}

app.RecordCustomEvent("terraform test", nil)

app.Shutdown(30 * time.Second)
}

Expand Down
Loading