Skip to content

Commit

Permalink
New Resource : azurerm_mongo_cluster (#27636)
Browse files Browse the repository at this point in the history
* new resource azurerm_mongo_cluster

* fix comments

* fix comments

* fix comments

* fix comments

* update test cases
  • Loading branch information
sinbai authored Nov 7, 2024
1 parent 0b1c1ff commit a19efaa
Show file tree
Hide file tree
Showing 51 changed files with 3,030 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/labeler-issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ service/mixed-reality:
service/mobile-network:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_mobile_network((.|\n)*)###'

service/mongo-cluster:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_mongo_cluster((.|\n)*)###'

service/monitor:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_monitor_((.|\n)*)###'

Expand Down
5 changes: 5 additions & 0 deletions .github/labeler-pull-request-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ service/mobile-network:
- any-glob-to-any-file:
- internal/services/mobilenetwork/**/*

service/mongo-cluster:
- changed-files:
- any-glob-to-any-file:
- internal/services/mongocluster/**/*

service/monitor:
- changed-files:
- any-glob-to-any-file:
Expand Down
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(
"mssqlmanagedinstance" to "Microsoft SQL Server Managed Instances",
"mixedreality" to "Mixed Reality",
"mobilenetwork" to "Mobile Network",
"mongocluster" to "Mongo Cluster",
"monitor" to "Monitor",
"mysql" to "MySQL",
"netapp" to "NetApp",
Expand Down
3 changes: 3 additions & 0 deletions .teamcity/components/settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ var serviceTestConfigurationOverrides = mapOf(
// MobileNetwork is only available in certain locations
"mobilenetwork" to testConfiguration(locationOverride = LocationConfiguration("eastus", "westeurope", "centraluseuap", false)),

// Mongocluster free tier is currently only available in southindia
"mongocluster" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "eastus2", "southindia", false)),

// MSSQl uses app service which is only available in certain locations
"mssql" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "francecentral", "eastus2", 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 @@ -97,6 +97,7 @@ import (
maps "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/client"
mixedreality "github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/client"
mobilenetwork "github.com/hashicorp/terraform-provider-azurerm/internal/services/mobilenetwork/client"
mongocluster "github.com/hashicorp/terraform-provider-azurerm/internal/services/mongocluster/client"
monitor "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/client"
mssql "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/client"
mssqlmanagedinstance "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssqlmanagedinstance/client"
Expand Down Expand Up @@ -231,6 +232,7 @@ type Client struct {
MixedReality *mixedreality.Client
Monitor *monitor.Client
MobileNetwork *mobilenetwork.Client
MongoCluster *mongocluster.Client
MSSQL *mssql.Client
MSSQLManagedInstance *mssqlmanagedinstance.Client
MySQL *mysql.Client
Expand Down Expand Up @@ -514,6 +516,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.MobileNetwork, err = mobilenetwork.NewClient(o); err != nil {
return fmt.Errorf("building clients for Mobile Network: %+v", err)
}
if client.MongoCluster, err = mongocluster.NewClient(o); err != nil {
return fmt.Errorf("building clients for Mongo Cluster: %+v", err)
}
if client.MSSQL, err = mssql.NewClient(o); err != nil {
return fmt.Errorf("building clients for MSSQL: %+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 @@ -81,6 +81,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/maps"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mobilenetwork"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mongocluster"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/mssqlmanagedinstance"
Expand Down Expand Up @@ -183,6 +184,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
maintenance.Registration{},
managedhsm.Registration{},
mobilenetwork.Registration{},
mongocluster.Registration{},
monitor.Registration{},
mssql.Registration{},
mssqlmanagedinstance.Registration{},
Expand Down
28 changes: 28 additions & 0 deletions internal/services/mongocluster/client/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package client

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/mongocluster/2024-07-01/mongoclusters"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
MongoClustersClient *mongoclusters.MongoClustersClient
}

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

mongoClustersClient, err := mongoclusters.NewMongoClustersClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building MongoClusters client: %+v", err)
}
o.Configure(mongoClustersClient.Client, o.Authorizers.ResourceManager)

return &Client{
MongoClustersClient: mongoClustersClient,
}, nil
}
Loading

0 comments on commit a19efaa

Please sign in to comment.