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

New Resource: azurerm_new_relic_monitor #21958

Merged
merged 9 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ var services = mapOf(
"mysql" to "MySQL",
"netapp" to "NetApp",
"network" to "Network",
"newrelic" to "New Relic",
"nginx" to "Nginx",
"notificationhub" to "Notification Hub",
"orbital" to "Orbital",
Expand Down
3 changes: 3 additions & 0 deletions .teamcity/components/settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ var serviceTestConfigurationOverrides = mapOf(
// netapp has a max of 10 accounts and the max capacity of pool is 25 TiB per subscription so lets limit it to 1 to account for broken ones, run Monday, Wednesday, Friday
"netapp" to testConfiguration(parallelism = 1, daysOfWeek = "2,4,6", locationOverride = LocationConfiguration("westeurope", "eastus2", "westus2", false), useDevTestSubscription = true),

// New Relic is only available in East US region
"newrelic" to testConfiguration(locationOverride = LocationConfiguration("eastus", "eastus", "eastus", false)),

// Orbital is only available in certain locations
"orbital" to testConfiguration(locationOverride = LocationConfiguration("eastus", "southcentralus", "westus2", false)),

Expand Down
5 changes: 5 additions & 0 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import (
mysql "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/client"
netapp "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/client"
network "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/client"
newrelic "github.com/hashicorp/terraform-provider-azurerm/internal/services/newrelic/client"
nginx "github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx/client"
notificationhub "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client"
orbital "github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital/client"
Expand Down Expand Up @@ -222,6 +223,7 @@ type Client struct {
MySQL *mysql.Client
NetApp *netapp.Client
Network *network.Client
NewRelic *newrelic.Client
Nginx *nginx2.Client
NotificationHubs *notificationhub.Client
Orbital *orbital.Client
Expand Down Expand Up @@ -410,6 +412,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.Network, err = network.NewClient(o); err != nil {
return fmt.Errorf("building clients for Network: %+v", err)
}
if client.NewRelic, err = newrelic.NewClient(o); err != nil {
return fmt.Errorf("building clients for NewRelic: %+v", err)
}
if client.Nginx, err = nginx.NewClient(o); err != nil {
return fmt.Errorf("building clients for Nginx: %+v", err)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/newrelic"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital"
Expand Down Expand Up @@ -164,6 +165,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
mysql.Registration{},
network.Registration{},
netapp.Registration{},
newrelic.Registration{},
nginx.Registration{},
policy.Registration{},
privatednsresolver.Registration{},
Expand Down
23 changes: 23 additions & 0 deletions internal/services/newrelic/client/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package client

import (
"github.com/hashicorp/go-azure-sdk/resource-manager/newrelic/2022-07-01/monitors"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
MonitorsClient *monitors.MonitorsClient
}

func NewClient(o *common.ClientOptions) (*Client, error) {

monitorsClient, err := monitors.NewMonitorsClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, err
}
o.Configure(monitorsClient.Client, o.Authorizers.ResourceManager)

return &Client{
MonitorsClient: monitorsClient,
}, nil
}
Loading