Skip to content

Commit

Permalink
chore: remove all references to flowdock and new relic third party in…
Browse files Browse the repository at this point in the history
…tegrations (#1616)

* remove all references to flowdock and newrelic third party integrations

* chore:remove unnecessary attributes
  • Loading branch information
oarbusi committed Nov 14, 2023
1 parent a164af1 commit 554e3e8
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 198 deletions.
10 changes: 0 additions & 10 deletions mongodbatlas/data_source_mongodbatlas_third_party_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ func thirdPartyIntegrationSchema() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"license_key": {
Type: schema.TypeString,
Sensitive: true,
Computed: true,
},
"account_id": {
Type: schema.TypeString,
Computed: true,
Expand All @@ -60,11 +55,6 @@ func thirdPartyIntegrationSchema() *schema.Resource {
Sensitive: true,
Computed: true,
},
"api_token": {
Type: schema.TypeString,
Sensitive: true,
Computed: true,
},
"team_name": {
Type: schema.TypeString,
Computed: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ const (
}
`

NEWRELIC = `
resource "mongodbatlas_third_party_integration" "%[1]s" {
project_id = "%[2]s"
type = "%[3]s"
license_key = "%[4]s"
account_id = "%[5]s"
write_token = "%[6]s"
read_token = "%[7]s"
}
`

OPSGENIE = `
resource "mongodbatlas_third_party_integration" "%[1]s" {
project_id = "%[2]s"
Expand All @@ -67,16 +56,6 @@ const (
}
`

FLOWDOCK = `
resource "mongodbatlas_third_party_integration" "%[1]s" {
project_id = "%[2]s"
type = "%[3]s"
flow_name = "%[4]s"
api_token = "%[5]s"
org_name = "%[6]s"
}
`

MICROSOFTTEAMS = `
resource "mongodbatlas_third_party_integration" "%[1]s" {
project_id = "%[2]s"
Expand Down Expand Up @@ -171,7 +150,7 @@ func testAccMongoDBAtlasThirdPartyIntegrationResourceConfig(config *thirdPartyCo
config.Name,
config.ProjectID,
config.Integration.Type,
config.Integration.LicenseKey,
config.Integration.ServiceKey,
)
case "DATADOG":
return fmt.Sprintf(DATADOG,
Expand All @@ -181,16 +160,6 @@ func testAccMongoDBAtlasThirdPartyIntegrationResourceConfig(config *thirdPartyCo
config.Integration.APIKey,
config.Integration.Region,
)
case "NEW_RELIC":
return fmt.Sprintf(NEWRELIC,
config.Name,
config.ProjectID,
config.Integration.Type,
config.Integration.LicenseKey,
config.Integration.AccountID,
config.Integration.WriteToken,
config.Integration.ReadToken,
)
case "OPS_GENIE":
return fmt.Sprintf(OPSGENIE,
config.Name,
Expand Down Expand Up @@ -243,22 +212,14 @@ func testAccMongoDBAtlasThirdPartyIntegrationResourceConfig(config *thirdPartyCo
func testAccCreateThirdPartyIntegrationConfig() *matlas.ThirdPartyIntegration {
account := testGenString(6, numeric)
return &matlas.ThirdPartyIntegration{
Type: "OPS_GENIE",
// Pager dutty 20-character strings
LicenseKey: testGenString(20, alphabet),
APIToken: fmt.Sprintf("xoxb-%s-%s-%s", testGenString(12, numeric), testGenString(12, numeric), testGenString(24, alphaNum)),
Type: "OPS_GENIE",
TeamName: "MongoSlackTestTeam " + account,
ChannelName: "MongoSlackTestChannel " + account,
// DataDog 40
APIKey: testGenString(40, alphaNum),
Region: "EU",

AccountID: account,
WriteToken: "write-test-" + testGenString(20, alphaNum),
APIKey: testGenString(40, alphaNum),
Region: "EU",
ReadToken: "read-test-" + testGenString(20, alphaNum),
RoutingKey: testGenString(40, alphaNum),
FlowName: "MongoFlow test" + account,
OrgName: "MongoOrgTest " + account,
URL: "https://www.mongodb.com/webhook",
Secret: account,
UserName: "PROM_USER",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func integrationToSchema(d *schema.ResourceData, integration *matlas.ThirdPartyI
"api_key": integrationSchema.APIKey,
"region": integration.Region,
"service_key": integrationSchema.ServiceKey,
"api_token": integrationSchema.APIToken,
"team_name": integration.TeamName,
"channel_name": integration.ChannelName,
"routing_key": integrationSchema.RoutingKey,
Expand All @@ -109,7 +108,7 @@ func integrationToSchema(d *schema.ResourceData, integration *matlas.ThirdPartyI
}

// removing optional empty values, terraform complains about unexpected values even though they're empty
optionals := []string{"api_key", "region", "service_key", "api_token",
optionals := []string{"api_key", "region", "service_key",
"team_name", "channel_name", "url", "secret", "password"}

for _, attr := range optionals {
Expand All @@ -131,22 +130,6 @@ func schemaToIntegration(in *schema.ResourceData) (out *matlas.ThirdPartyIntegra
out.Type = _type.(string)
}

if licenseKey, ok := in.GetOk("license_key"); ok {
out.LicenseKey = licenseKey.(string)
}

if accountID, ok := in.GetOk("account_id"); ok {
out.AccountID = accountID.(string)
}

if writeToken, ok := in.GetOk("write_token"); ok {
out.WriteToken = writeToken.(string)
}

if readToken, ok := in.GetOk("read_token"); ok {
out.ReadToken = readToken.(string)
}

if apiKey, ok := in.GetOk("api_key"); ok {
out.APIKey = apiKey.(string)
}
Expand All @@ -159,10 +142,6 @@ func schemaToIntegration(in *schema.ResourceData) (out *matlas.ThirdPartyIntegra
out.ServiceKey = serviceKey.(string)
}

if apiToken, ok := in.GetOk("api_token"); ok {
out.APIToken = apiToken.(string)
}

if teamName, ok := in.GetOk("team_name"); ok {
out.TeamName = teamName.(string)
}
Expand All @@ -175,14 +154,6 @@ func schemaToIntegration(in *schema.ResourceData) (out *matlas.ThirdPartyIntegra
out.RoutingKey = routingKey.(string)
}

if flowName, ok := in.GetOk("flow_name"); ok {
out.FlowName = flowName.(string)
}

if orgName, ok := in.GetOk("org_name"); ok {
out.OrgName = orgName.(string)
}

if url, ok := in.GetOk("url"); ok {
out.URL = url.(string)
}
Expand Down Expand Up @@ -219,22 +190,6 @@ func schemaToIntegration(in *schema.ResourceData) (out *matlas.ThirdPartyIntegra
}

func updateIntegrationFromSchema(d *schema.ResourceData, integration *matlas.ThirdPartyIntegration) {
if d.HasChange("license_key") {
integration.LicenseKey = d.Get("license_key").(string)
}

if d.HasChange("account_id") {
integration.AccountID = d.Get("account_id").(string)
}

if d.HasChange("write_token") {
integration.WriteToken = d.Get("write_token").(string)
}

if d.HasChange("read_token") {
integration.ReadToken = d.Get("read_token").(string)
}

integration.APIKey = d.Get("api_key").(string)

if d.HasChange("region") {
Expand All @@ -245,10 +200,6 @@ func updateIntegrationFromSchema(d *schema.ResourceData, integration *matlas.Thi
integration.ServiceKey = d.Get("service_key").(string)
}

if d.HasChange("api_token") {
integration.APIToken = d.Get("api_token").(string)
}

if d.HasChange("team_name") {
integration.TeamName = d.Get("team_name").(string)
}
Expand All @@ -261,14 +212,6 @@ func updateIntegrationFromSchema(d *schema.ResourceData, integration *matlas.Thi
integration.RoutingKey = d.Get("routing_key").(string)
}

if d.HasChange("flow_name") {
integration.FlowName = d.Get("flow_name").(string)
}

if d.HasChange("org_name") {
integration.OrgName = d.Get("org_name").(string)
}

if d.HasChange("url") {
integration.URL = d.Get("url").(string)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestAccConfigDSThirdPartyIntegrations_basic(t *testing.T) {
SkipTestForCI(t)
var (
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID")
intgTypes = []string{"NEW_RELIC", "OPS_GENIE", "DATADOG", "VICTOR_OPS", "WEBHOOK", "PROMETHEUS"}
intgTypes = []string{"OPS_GENIE", "DATADOG", "VICTOR_OPS", "WEBHOOK", "PROMETHEUS"}
hclConfig = make([]*thirdPartyConfig, 0, len(intgTypes))
dsName = "data.mongodbatlas_third_party_integrations.test"
integrationType = ""
Expand Down
13 changes: 0 additions & 13 deletions mongodbatlas/resource_mongodbatlas_third_party_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ var integrationTypes = []string{
"PROMETHEUS",
}

var deprecatedIntegrationTypes = []string{
"NEW_RELIC",
"FLOWDOCK",
}

var requiredPerType = map[string][]string{
"PAGER_DUTY": {"service_key"},
"DATADOG": {"api_key", "region"},
Expand Down Expand Up @@ -292,14 +287,6 @@ func validateIntegrationType() schema.SchemaValidateDiagFunc {
}
diags = append(diags, diagError)
}
if isElementExist(deprecatedIntegrationTypes, value) {
diagWarn := diag.Diagnostic{
Severity: diag.Warning,
Summary: "Warning deprecated Third Party Integration type",
Detail: fmt.Sprintf("Third Party integration type %q is a deprecated value. This field type values %q are deprecated and will be removed in 1.9.0 release", value, deprecatedIntegrationTypes),
}
diags = append(diags, diagWarn)
}
return diags
}
}
Expand Down
4 changes: 0 additions & 4 deletions website/docs/d/alert_configuration.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,10 @@ Notifications to send when an alert condition is detected.
* `delay_min` - Number of minutes to wait after an alert condition is detected before sending out the first notification.
* `email_address` - Email address to which alert notifications are sent. Required for the EMAIL notifications type.
* `email_enabled` - Flag indicating email notifications should be sent. Atlas returns this value if `type_name` is set to `ORG`, `GROUP`, or `USER`.
* `flowdock_api_token` - The Flowdock personal API token. Required for the `FLOWDOCK` notifications type. If the token later becomes invalid, Atlas sends an email to the project owner and eventually removes the token.
* `flow_name` - Flowdock flow name in lower-case letters. Required for the `FLOWDOCK` notifications type.
* `interval_min` - Number of minutes to wait between successive notifications for unacknowledged alerts that are not resolved. The minimum value is 5.
* `mobile_number` - Mobile number to which alert notifications are sent. Required for the SMS notifications type.
* `ops_genie_api_key` - Opsgenie API Key. Required for the `OPS_GENIE` notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the token.
* `ops_genie_region` - Region that indicates which API URL to use. Accepted regions are: `US` ,`EU`. The default Opsgenie region is US.
* `org_name` - Flowdock organization name in lower-case letters. This is the name that appears after www.flowdock.com/app/ in the URL string. Required for the FLOWDOCK notifications type.
* `service_key` - PagerDuty service key. Required for the PAGER_DUTY notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the key.
* `sms_enabled` - Flag indicating text notifications should be sent. Atlas returns this value if `type_name` is set to `ORG`, `GROUP`, or `USER`.
* `team_id` - Unique identifier of a team.
Expand All @@ -217,7 +214,6 @@ Notifications to send when an alert condition is detected.
Accepted values are:
- `DATADOG`
- `EMAIL`
- `FLOWDOCK`
- `GROUP` (Project)
- `OPS_GENIE`
- `ORG`
Expand Down
4 changes: 0 additions & 4 deletions website/docs/d/alert_configurations.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,10 @@ Notifications to send when an alert condition is detected.
* `delay_min` - Number of minutes to wait after an alert condition is detected before sending out the first notification.
* `email_address` - Email address to which alert notifications are sent. Required for the EMAIL notifications type.
* `email_enabled` - Flag indicating email notifications should be sent. Atlas returns this value if `type_name` is set to `ORG`, `GROUP`, or `USER`.
* `flowdock_api_token` - The Flowdock personal API token. Required for the `FLOWDOCK` notifications type. If the token later becomes invalid, Atlas sends an email to the project owner and eventually removes the token.
* `flow_name` - Flowdock flow name in lower-case letters. Required for the `FLOWDOCK` notifications type.
* `interval_min` - Number of minutes to wait between successive notifications for unacknowledged alerts that are not resolved. The minimum value is 5.
* `mobile_number` - Mobile number to which alert notifications are sent. Required for the SMS notifications type.
* `ops_genie_api_key` - Opsgenie API Key. Required for the `OPS_GENIE` notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the token.
* `ops_genie_region` - Region that indicates which API URL to use. Accepted regions are: `US` ,`EU`. The default Opsgenie region is US.
* `org_name` - Flowdock organization name in lower-case letters. This is the name that appears after www.flowdock.com/app/ in the URL string. Required for the FLOWDOCK notifications type.
* `service_key` - PagerDuty service key. Required for the PAGER_DUTY notifications type. If the key later becomes invalid, Atlas sends an email to the project owner and eventually removes the key.
* `sms_enabled` - Flag indicating text notifications should be sent. Atlas returns this value if `type_name` is set to `ORG`, `GROUP`, or `USER`.
* `team_id` - Unique identifier of a team.
Expand All @@ -161,7 +158,6 @@ Notifications to send when an alert condition is detected.
Accepted values are:
- `DATADOG`
- `EMAIL`
- `FLOWDOCK`
- `GROUP` (Project)
- `OPS_GENIE`
- `ORG`
Expand Down
25 changes: 5 additions & 20 deletions website/docs/d/third_party_integration.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ description: |-

```terraform
resource "mongodbatlas_third_party_integration" "test_flowdock" {
resource "mongodbatlas_third_party_integration" "test_datadog" {
project_id = "<PROJECT-ID>"
type = "FLOWDOCK"
flow_name = "<FLOW-NAME>"
api_token = "<API-TOKEN>"
org_name = "<ORG-NAME>"
type = "DATADOG"
api_key = "<API-KEY>"
region = "<REGION>"
}
data "mongodbatlas_third_party_integration" "test" {
project_id = mongodbatlas_third_party_integration.test_flowdock.project_id
project_id = mongodbatlas_third_party_integration.test_datadog.project_id
}
```

Expand All @@ -35,17 +34,12 @@ data "mongodbatlas_third_party_integration" "test" {
* `type` - (Required) Third-Party service integration type
* PAGER_DUTY
* DATADOG
* NEW_RELIC*
* OPS_GENIE
* VICTOR_OPS
* FLOWDOCK*
* WEBHOOK
* MICROSOFT_TEAMS
* PROMETHEUS

*resource is now deprecated and will be removed in the next major version, 1.9.0
**Note:** Field types NEW_RELIC, FLOWDOCK have now been fully deprecated as part of v1.10.0 release

## Attributes Reference

In addition to all arguments above, the following attributes are exported:
Expand All @@ -60,21 +54,12 @@ Additional values based on Type
* `DATADOG`
* `api_key` - Your API Key.
* `region` - Indicates which API URL to use, either "US", "EU", "US3", or "US5". Datadog will use "US" by default.
* `NEW_RELIC`
* `license_key` - Your License Key.
* `account_id` - Unique identifier of your New Relic account.
* `write_token` - Your Insights Insert Key.
* `read_token` - Your Insights Query Key.
* `OPS_GENIE`
* `api_key` - Your API Key.
* `region` - Indicates which API URL to use, either US or EU. Opsgenie will use US by default.
* `VICTOR_OPS`
* `api_key` - Your API Key.
* `routing_key` - An optional field for your Routing Key.
* `FLOWDOCK`
* `flow_name` - Your Flowdock Flow name.
* `api_token` - Your API Token.
* `org_name` - Your Flowdock organization name.
* `WEBHOOK`
* `url` - Your webhook URL.
* `secret` - An optional field for your webhook secret.
Expand Down

0 comments on commit 554e3e8

Please sign in to comment.