Skip to content

Commit

Permalink
Merge pull request #20451 from teowa/network_manager_commit
Browse files Browse the repository at this point in the history
New Resouce `azurerm_network_manager_deployment`
  • Loading branch information
manicminer authored May 9, 2023
2 parents 7eb34ed + 6b8a846 commit cb1665a
Show file tree
Hide file tree
Showing 35 changed files with 2,318 additions and 27 deletions.
4 changes: 3 additions & 1 deletion internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
client.MSSQLManagedInstance = mssqlmanagedinstance.NewClient(o)
client.MySQL = mysql.NewClient(o)
client.NetApp = netapp.NewClient(o)
client.Network = network.NewClient(o)
if client.Network, err = network.NewClient(o); err != nil {
return fmt.Errorf("building clients for Network: %+v", err)
}
client.Nginx = nginx.NewClient(o)
client.NotificationHubs = notificationhub.NewClient(o)
client.Orbital = orbital.NewClient(o)
Expand Down
14 changes: 0 additions & 14 deletions internal/provider/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,6 @@ func schemaFeatures(supportLegacyTestSuite bool) *pluginsdk.Schema {
},
},

"network": {
Type: pluginsdk.TypeList,
Optional: true,
MaxItems: 1,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"relaxed_locking": {
Type: pluginsdk.TypeBool,
Required: true,
},
},
},
},

"template_deployment": {
Type: pluginsdk.TypeList,
Optional: true,
Expand Down
10 changes: 0 additions & 10 deletions internal/provider/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ func TestExpandFeatures(t *testing.T) {
"expand_without_downtime": true,
},
},
"network": []interface{}{
map[string]interface{}{
"relaxed_locking": true,
},
},
"resource_group": []interface{}{
map[string]interface{}{
"prevent_deletion_if_contains_resources": true,
Expand Down Expand Up @@ -246,11 +241,6 @@ func TestExpandFeatures(t *testing.T) {
"expand_without_downtime": false,
},
},
"network_locking": []interface{}{
map[string]interface{}{
"relaxed_locking": false,
},
},
"resource_group": []interface{}{
map[string]interface{}{
"prevent_deletion_if_contains_resources": false,
Expand Down
18 changes: 16 additions & 2 deletions internal/services/network/client/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package client

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-09-01/networkmanagers"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
"github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network"
)
Expand Down Expand Up @@ -29,6 +32,7 @@ type Client struct {
ManagersClient *network.ManagersClient
ManagerAdminRulesClient *network.AdminRulesClient
ManagerAdminRuleCollectionsClient *network.AdminRuleCollectionsClient
ManagerDeploymentsClient *networkmanagers.NetworkManagersClient
ManagerConnectivityConfigurationsClient *network.ConnectivityConfigurationsClient
ManagerManagementGroupConnectionsClient *network.ManagementGroupNetworkManagerConnectionsClient
ManagerNetworkGroupsClient *network.GroupsClient
Expand Down Expand Up @@ -76,7 +80,7 @@ type Client struct {
ResourceNavigationLinkClient *network.ResourceNavigationLinksClient
}

func NewClient(o *common.ClientOptions) *Client {
func NewClient(o *common.ClientOptions) (*Client, error) {
ApplicationGatewaysClient := network.NewApplicationGatewaysClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&ApplicationGatewaysClient.Client, o.ResourceManagerAuthorizer)

Expand Down Expand Up @@ -149,6 +153,15 @@ func NewClient(o *common.ClientOptions) *Client {
ManagerConnectivityConfigurationsClient := network.NewConnectivityConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&ManagerConnectivityConfigurationsClient.Client, o.ResourceManagerAuthorizer)

ManagerDeploymentsClient, err := networkmanagers.NewNetworkManagersClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building deployment client: %+v", err)
}
o.Configure(ManagerDeploymentsClient.Client, o.Authorizers.ResourceManager)

ManagerDeploymentStatusClient := network.NewManagerDeploymentStatusClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&ManagerDeploymentStatusClient.Client, o.ResourceManagerAuthorizer)

ManagerScopeConnectionsClient := network.NewScopeConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&ManagerScopeConnectionsClient.Client, o.ResourceManagerAuthorizer)

Expand Down Expand Up @@ -306,6 +319,7 @@ func NewClient(o *common.ClientOptions) *Client {
ManagerAdminRulesClient: &ManagerAdminRulesClient,
ManagerAdminRuleCollectionsClient: &ManagerAdminRuleCollectionsClient,
ManagerConnectivityConfigurationsClient: &ManagerConnectivityConfigurationsClient,
ManagerDeploymentsClient: ManagerDeploymentsClient,
ManagerManagementGroupConnectionsClient: &ManagerManagementGroupConnectionsClient,
ManagerNetworkGroupsClient: &ManagerNetworkGroupsClient,
ManagerScopeConnectionsClient: &ManagerScopeConnectionsClient,
Expand Down Expand Up @@ -350,5 +364,5 @@ func NewClient(o *common.ClientOptions) *Client {
PrivateLinkServiceClient: &PrivateLinkServiceClient,
ServiceAssociationLinkClient: &ServiceAssociationLinkClient,
ResourceNavigationLinkClient: &ResourceNavigationLinkClient,
}
}, nil
}
Loading

0 comments on commit cb1665a

Please sign in to comment.