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

[11/X] DXCDT-441: Reintroduce support for new relic client addon #667

Merged
merged 1 commit into from
Jun 29, 2023
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
9 changes: 9 additions & 0 deletions docs/data-sources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Read-Only:
- `egnyte` (List of Object) (see [below for nested schema](#nestedobjatt--addons--egnyte))
- `firebase` (List of Object) (see [below for nested schema](#nestedobjatt--addons--firebase))
- `mscrm` (List of Object) (see [below for nested schema](#nestedobjatt--addons--mscrm))
- `newrelic` (List of Object) (see [below for nested schema](#nestedobjatt--addons--newrelic))
- `rms` (List of Object) (see [below for nested schema](#nestedobjatt--addons--rms))
- `sentry` (List of Object) (see [below for nested schema](#nestedobjatt--addons--sentry))
- `slack` (List of Object) (see [below for nested schema](#nestedobjatt--addons--slack))
Expand Down Expand Up @@ -162,6 +163,14 @@ Read-Only:
- `url` (String)


<a id="nestedobjatt--addons--newrelic"></a>
### Nested Schema for `addons.newrelic`

Read-Only:

- `account` (String)


<a id="nestedobjatt--addons--rms"></a>
### Nested Schema for `addons.rms`

Expand Down
9 changes: 9 additions & 0 deletions docs/data-sources/global_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Read-Only:
- `egnyte` (List of Object) (see [below for nested schema](#nestedobjatt--addons--egnyte))
- `firebase` (List of Object) (see [below for nested schema](#nestedobjatt--addons--firebase))
- `mscrm` (List of Object) (see [below for nested schema](#nestedobjatt--addons--mscrm))
- `newrelic` (List of Object) (see [below for nested schema](#nestedobjatt--addons--newrelic))
- `rms` (List of Object) (see [below for nested schema](#nestedobjatt--addons--rms))
- `sentry` (List of Object) (see [below for nested schema](#nestedobjatt--addons--sentry))
- `slack` (List of Object) (see [below for nested schema](#nestedobjatt--addons--slack))
Expand Down Expand Up @@ -151,6 +152,14 @@ Read-Only:
- `url` (String)


<a id="nestedobjatt--addons--newrelic"></a>
### Nested Schema for `addons.newrelic`

Read-Only:

- `account` (String)


<a id="nestedobjatt--addons--rms"></a>
### Nested Schema for `addons.rms`

Expand Down
9 changes: 9 additions & 0 deletions docs/resources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Optional:
- `egnyte` (Block List, Max: 1) Egnyte SSO configuration. (see [below for nested schema](#nestedblock--addons--egnyte))
- `firebase` (Block List, Max: 1) Google Firebase addon configuration. (see [below for nested schema](#nestedblock--addons--firebase))
- `mscrm` (Block List, Max: 1) Microsoft Dynamics CRM SSO configuration. (see [below for nested schema](#nestedblock--addons--mscrm))
- `newrelic` (Block List, Max: 1) New Relic SSO configuration. (see [below for nested schema](#nestedblock--addons--newrelic))
- `rms` (Block List, Max: 1) Active Directory Rights Management Service SSO configuration. (see [below for nested schema](#nestedblock--addons--rms))
- `sentry` (Block List, Max: 1) Sentry SSO configuration. (see [below for nested schema](#nestedblock--addons--sentry))
- `slack` (Block List, Max: 1) Slack team or workspace name usually first segment in your Slack URL, for example `https://acme-org.slack.com` would be `acme-org`. (see [below for nested schema](#nestedblock--addons--slack))
Expand Down Expand Up @@ -224,6 +225,14 @@ Optional:
- `url` (String) Microsoft Dynamics CRM application URL.


<a id="nestedblock--addons--newrelic"></a>
### Nested Schema for `addons.newrelic`

Optional:

- `account` (String) Your New Relic Account ID found in your New Relic URL after the `/accounts/` path, for example `https://rpm.newrelic.com/accounts/123456/query` would be `123456`.


<a id="nestedblock--addons--rms"></a>
### Nested Schema for `addons.rms`

Expand Down
9 changes: 9 additions & 0 deletions docs/resources/global_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Optional:
- `egnyte` (Block List, Max: 1) Egnyte SSO configuration. (see [below for nested schema](#nestedblock--addons--egnyte))
- `firebase` (Block List, Max: 1) Google Firebase addon configuration. (see [below for nested schema](#nestedblock--addons--firebase))
- `mscrm` (Block List, Max: 1) Microsoft Dynamics CRM SSO configuration. (see [below for nested schema](#nestedblock--addons--mscrm))
- `newrelic` (Block List, Max: 1) New Relic SSO configuration. (see [below for nested schema](#nestedblock--addons--newrelic))
- `rms` (Block List, Max: 1) Active Directory Rights Management Service SSO configuration. (see [below for nested schema](#nestedblock--addons--rms))
- `sentry` (Block List, Max: 1) Sentry SSO configuration. (see [below for nested schema](#nestedblock--addons--sentry))
- `slack` (Block List, Max: 1) Slack team or workspace name usually first segment in your Slack URL, for example `https://acme-org.slack.com` would be `acme-org`. (see [below for nested schema](#nestedblock--addons--slack))
Expand Down Expand Up @@ -167,6 +168,14 @@ Optional:
- `url` (String) Microsoft Dynamics CRM application URL.


<a id="nestedblock--addons--newrelic"></a>
### Nested Schema for `addons.newrelic`

Optional:

- `account` (String) Your New Relic Account ID found in your New Relic URL after the `/accounts/` path, for example `https://rpm.newrelic.com/accounts/123456/query` would be `123456`.


<a id="nestedblock--addons--rms"></a>
### Nested Schema for `addons.rms`

Expand Down
15 changes: 15 additions & 0 deletions internal/auth0/client/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ func expandClientAddons(d *schema.ResourceData) *management.ClientAddons {
addons.EchoSign = expandClientAddonEchoSign(addonsCfg.GetAttr("echosign"))
addons.Egnyte = expandClientAddonEgnyte(addonsCfg.GetAttr("egnyte"))
addons.Firebase = expandClientAddonFirebase(addonsCfg.GetAttr("firebase"))
addons.NewRelic = expandClientAddonNewRelic(addonsCfg.GetAttr("newrelic"))
return stop
})

Expand Down Expand Up @@ -439,6 +440,20 @@ func expandClientAddonFirebase(firebaseCfg cty.Value) *management.FirebaseClient
return &firebaseAddon
}

func expandClientAddonNewRelic(newRelicCfg cty.Value) *management.NewRelicClientAddon {
var newRelicAddon management.NewRelicClientAddon

newRelicCfg.ForEachElement(func(_ cty.Value, newRelicCfg cty.Value) (stop bool) {
newRelicAddon = management.NewRelicClientAddon{
Account: value.String(newRelicCfg.GetAttr("account")),
}

return stop
})

return &newRelicAddon
}

func clientHasChange(c *management.Client) bool {
return c.String() != "{}"
}
8 changes: 8 additions & 0 deletions internal/auth0/client/flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,13 @@ func flattenClientAddons(addons *management.ClientAddons) []interface{} {
}
}

if addons.GetNewRelic() != nil {
m["newrelic"] = []interface{}{
map[string]interface{}{
"account": addons.GetNewRelic().GetAccount(),
},
}
}

return []interface{}{m}
}
17 changes: 17 additions & 0 deletions internal/auth0/client/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,23 @@ func NewResource() *schema.Resource {
},
},
},
"newrelic": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Description: "New Relic SSO configuration.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"account": {
Description: "Your New Relic Account ID found in your New Relic URL after the " +
"`/accounts/` path, for example `https://rpm.newrelic.com/accounts/123456/query` would be `123456`.",
Type: schema.TypeString,
Optional: true,
},
},
},
},
},
},
},
Expand Down
22 changes: 22 additions & 0 deletions internal/auth0/client/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,19 @@ resource "auth0_client" "my_client" {
}
`

const testAccUpdateClientWithAddonsNewRelic = `
resource "auth0_client" "my_client" {
name = "Acceptance Test - SSO Integration - {{.testName}}"
app_type = "sso_integration"

addons {
newrelic {
account = "123456"
}
}
}
`

func TestAccClientAddons(t *testing.T) {
acctest.Test(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down Expand Up @@ -1007,6 +1020,15 @@ func TestAccClientAddons(t *testing.T) {
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.0.firebase.0.lifetime_in_seconds", "7200"),
),
},
{
Config: acctest.ParseTestName(testAccUpdateClientWithAddonsNewRelic, t.Name()),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_client.my_client", "name", fmt.Sprintf("Acceptance Test - SSO Integration - %s", t.Name())),
resource.TestCheckResourceAttr("auth0_client.my_client", "app_type", "sso_integration"),
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.#", "1"),
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.0.newrelic.0.account", "123456"),
),
},
},
})
}
Expand Down
Loading