Skip to content

Commit

Permalink
Test Shim: Network s -> v resources (#10221)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbfrahry authored Jan 19, 2021
1 parent 9bcd462 commit 7b120be
Show file tree
Hide file tree
Showing 57 changed files with 2,908 additions and 4,133 deletions.
56 changes: 28 additions & 28 deletions azurerm/internal/services/network/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ func (r Registration) SupportedDataSources() map[string]*schema.Resource {
"azurerm_route_filter": dataSourceRouteFilter(),
"azurerm_route_table": dataSourceRouteTable(),
"azurerm_network_service_tags": dataSourceNetworkServiceTags(),
"azurerm_subnet": dataSourceArmSubnet(),
"azurerm_virtual_hub": dataSourceArmVirtualHub(),
"azurerm_virtual_network_gateway": dataSourceArmVirtualNetworkGateway(),
"azurerm_virtual_network_gateway_connection": dataSourceArmVirtualNetworkGatewayConnection(),
"azurerm_virtual_network": dataSourceArmVirtualNetwork(),
"azurerm_web_application_firewall_policy": dataArmWebApplicationFirewallPolicy(),
"azurerm_virtual_wan": dataSourceArmVirtualWan(),
"azurerm_subnet": dataSourceSubnet(),
"azurerm_virtual_hub": dataSourceVirtualHub(),
"azurerm_virtual_network_gateway": dataSourceVirtualNetworkGateway(),
"azurerm_virtual_network_gateway_connection": dataSourceVirtualNetworkGatewayConnection(),
"azurerm_virtual_network": dataSourceVirtualNetwork(),
"azurerm_web_application_firewall_policy": dataWebApplicationFirewallPolicy(),
"azurerm_virtual_wan": dataSourceVirtualWan(),
}
}

Expand Down Expand Up @@ -85,26 +85,26 @@ func (r Registration) SupportedResources() map[string]*schema.Resource {
"azurerm_route_filter": resourceRouteFilter(),
"azurerm_route_table": resourceRouteTable(),
"azurerm_route": resourceRoute(),
"azurerm_virtual_hub_security_partner_provider": resourceArmVirtualHubSecurityPartnerProvider(),
"azurerm_subnet_service_endpoint_storage_policy": resourceArmSubnetServiceEndpointStoragePolicy(),
"azurerm_subnet_network_security_group_association": resourceArmSubnetNetworkSecurityGroupAssociation(),
"azurerm_subnet_route_table_association": resourceArmSubnetRouteTableAssociation(),
"azurerm_subnet_nat_gateway_association": resourceArmSubnetNatGatewayAssociation(),
"azurerm_subnet": resourceArmSubnet(),
"azurerm_virtual_hub": resourceArmVirtualHub(),
"azurerm_virtual_hub_bgp_connection": resourceArmVirtualHubBgpConnection(),
"azurerm_virtual_hub_connection": resourceArmVirtualHubConnection(),
"azurerm_virtual_hub_ip": resourceArmVirtualHubIP(),
"azurerm_virtual_hub_route_table": resourceArmVirtualHubRouteTable(),
"azurerm_virtual_network_gateway_connection": resourceArmVirtualNetworkGatewayConnection(),
"azurerm_virtual_network_gateway": resourceArmVirtualNetworkGateway(),
"azurerm_virtual_network_peering": resourceArmVirtualNetworkPeering(),
"azurerm_virtual_network": resourceArmVirtualNetwork(),
"azurerm_virtual_wan": resourceArmVirtualWan(),
"azurerm_vpn_gateway": resourceArmVPNGateway(),
"azurerm_vpn_gateway_connection": resourceArmVPNGatewayConnection(),
"azurerm_vpn_server_configuration": resourceArmVPNServerConfiguration(),
"azurerm_vpn_site": resourceArmVpnSite(),
"azurerm_web_application_firewall_policy": resourceArmWebApplicationFirewallPolicy(),
"azurerm_virtual_hub_security_partner_provider": resourceVirtualHubSecurityPartnerProvider(),
"azurerm_subnet_service_endpoint_storage_policy": resourceSubnetServiceEndpointStoragePolicy(),
"azurerm_subnet_network_security_group_association": resourceSubnetNetworkSecurityGroupAssociation(),
"azurerm_subnet_route_table_association": resourceSubnetRouteTableAssociation(),
"azurerm_subnet_nat_gateway_association": resourceSubnetNatGatewayAssociation(),
"azurerm_subnet": resourceSubnet(),
"azurerm_virtual_hub": resourceVirtualHub(),
"azurerm_virtual_hub_bgp_connection": resourceVirtualHubBgpConnection(),
"azurerm_virtual_hub_connection": resourceVirtualHubConnection(),
"azurerm_virtual_hub_ip": resourceVirtualHubIP(),
"azurerm_virtual_hub_route_table": resourceVirtualHubRouteTable(),
"azurerm_virtual_network_gateway_connection": resourceVirtualNetworkGatewayConnection(),
"azurerm_virtual_network_gateway": resourceVirtualNetworkGateway(),
"azurerm_virtual_network_peering": resourceVirtualNetworkPeering(),
"azurerm_virtual_network": resourceVirtualNetwork(),
"azurerm_virtual_wan": resourceVirtualWan(),
"azurerm_vpn_gateway": resourceVPNGateway(),
"azurerm_vpn_gateway_connection": resourceVPNGatewayConnection(),
"azurerm_vpn_server_configuration": resourceVPNServerConfiguration(),
"azurerm_vpn_site": resourceVpnSite(),
"azurerm_web_application_firewall_policy": resourceWebApplicationFirewallPolicy(),
}
}
6 changes: 3 additions & 3 deletions azurerm/internal/services/network/subnet_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func dataSourceArmSubnet() *schema.Resource {
func dataSourceSubnet() *schema.Resource {
return &schema.Resource{
Read: dataSourceArmSubnetRead,
Read: dataSourceSubnetRead,

Timeouts: &schema.ResourceTimeout{
Read: schema.DefaultTimeout(5 * time.Minute),
Expand Down Expand Up @@ -77,7 +77,7 @@ func dataSourceArmSubnet() *schema.Resource {
}
}

func dataSourceArmSubnetRead(d *schema.ResourceData, meta interface{}) error {
func dataSourceSubnetRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmSubnetNatGatewayAssociation() *schema.Resource {
func resourceSubnetNatGatewayAssociation() *schema.Resource {
return &schema.Resource{
Create: resourceArmSubnetNatGatewayAssociationCreate,
Read: resourceArmSubnetNatGatewayAssociationRead,
Delete: resourceArmSubnetNatGatewayAssociationDelete,
Create: resourceSubnetNatGatewayAssociationCreate,
Read: resourceSubnetNatGatewayAssociationRead,
Delete: resourceSubnetNatGatewayAssociationDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Expand Down Expand Up @@ -48,7 +48,7 @@ func resourceArmSubnetNatGatewayAssociation() *schema.Resource {
}
}

func resourceArmSubnetNatGatewayAssociationCreate(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetNatGatewayAssociationCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -114,10 +114,10 @@ func resourceArmSubnetNatGatewayAssociationCreate(d *schema.ResourceData, meta i
}
d.SetId(*read.ID)

return resourceArmSubnetNatGatewayAssociationRead(d, meta)
return resourceSubnetNatGatewayAssociationRead(d, meta)
}

func resourceArmSubnetNatGatewayAssociationRead(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetNatGatewayAssociationRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -158,7 +158,7 @@ func resourceArmSubnetNatGatewayAssociationRead(d *schema.ResourceData, meta int
return nil
}

func resourceArmSubnetNatGatewayAssociationDelete(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetNatGatewayAssociationDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmSubnetNetworkSecurityGroupAssociation() *schema.Resource {
func resourceSubnetNetworkSecurityGroupAssociation() *schema.Resource {
return &schema.Resource{
Create: resourceArmSubnetNetworkSecurityGroupAssociationCreate,
Read: resourceArmSubnetNetworkSecurityGroupAssociationRead,
Delete: resourceArmSubnetNetworkSecurityGroupAssociationDelete,
Create: resourceSubnetNetworkSecurityGroupAssociationCreate,
Read: resourceSubnetNetworkSecurityGroupAssociationRead,
Delete: resourceSubnetNetworkSecurityGroupAssociationDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Expand Down Expand Up @@ -49,7 +49,7 @@ func resourceArmSubnetNetworkSecurityGroupAssociation() *schema.Resource {
}
}

func resourceArmSubnetNetworkSecurityGroupAssociationCreate(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetNetworkSecurityGroupAssociationCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -120,10 +120,10 @@ func resourceArmSubnetNetworkSecurityGroupAssociationCreate(d *schema.ResourceDa

d.SetId(*read.ID)

return resourceArmSubnetNetworkSecurityGroupAssociationRead(d, meta)
return resourceSubnetNetworkSecurityGroupAssociationRead(d, meta)
}

func resourceArmSubnetNetworkSecurityGroupAssociationRead(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetNetworkSecurityGroupAssociationRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -164,7 +164,7 @@ func resourceArmSubnetNetworkSecurityGroupAssociationRead(d *schema.ResourceData
return nil
}

func resourceArmSubnetNetworkSecurityGroupAssociationDelete(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetNetworkSecurityGroupAssociationDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down
22 changes: 11 additions & 11 deletions azurerm/internal/services/network/subnet_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (

var SubnetResourceName = "azurerm_subnet"

func resourceArmSubnet() *schema.Resource {
func resourceSubnet() *schema.Resource {
return &schema.Resource{
Create: resourceArmSubnetCreate,
Read: resourceArmSubnetRead,
Update: resourceArmSubnetUpdate,
Delete: resourceArmSubnetDelete,
Create: resourceSubnetCreate,
Read: resourceSubnetRead,
Update: resourceSubnetUpdate,
Delete: resourceSubnetDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Expand Down Expand Up @@ -175,7 +175,7 @@ func resourceArmSubnet() *schema.Resource {
}

// TODO: refactor the create/flatten functions
func resourceArmSubnetCreate(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -257,10 +257,10 @@ func resourceArmSubnetCreate(d *schema.ResourceData, meta interface{}) error {

d.SetId(*read.ID)

return resourceArmSubnetRead(d, meta)
return resourceSubnetRead(d, meta)
}

func resourceArmSubnetUpdate(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -338,10 +338,10 @@ func resourceArmSubnetUpdate(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Error waiting for update of Subnet %q (Virtual Network %q / Resource Group %q): %+v", name, networkName, resourceGroup, err)
}

return resourceArmSubnetRead(d, meta)
return resourceSubnetRead(d, meta)
}

func resourceArmSubnetRead(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -401,7 +401,7 @@ func resourceArmSubnetRead(d *schema.ResourceData, meta interface{}) error {
return nil
}

func resourceArmSubnetDelete(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmSubnetRouteTableAssociation() *schema.Resource {
func resourceSubnetRouteTableAssociation() *schema.Resource {
return &schema.Resource{
Create: resourceArmSubnetRouteTableAssociationCreate,
Read: resourceArmSubnetRouteTableAssociationRead,
Delete: resourceArmSubnetRouteTableAssociationDelete,
Create: resourceSubnetRouteTableAssociationCreate,
Read: resourceSubnetRouteTableAssociationRead,
Delete: resourceSubnetRouteTableAssociationDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Expand Down Expand Up @@ -49,7 +49,7 @@ func resourceArmSubnetRouteTableAssociation() *schema.Resource {
}
}

func resourceArmSubnetRouteTableAssociationCreate(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetRouteTableAssociationCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -117,10 +117,10 @@ func resourceArmSubnetRouteTableAssociationCreate(d *schema.ResourceData, meta i

d.SetId(*read.ID)

return resourceArmSubnetRouteTableAssociationRead(d, meta)
return resourceSubnetRouteTableAssociationRead(d, meta)
}

func resourceArmSubnetRouteTableAssociationRead(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetRouteTableAssociationRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -161,7 +161,7 @@ func resourceArmSubnetRouteTableAssociationRead(d *schema.ResourceData, meta int
return nil
}

func resourceArmSubnetRouteTableAssociationDelete(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetRouteTableAssociationDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.SubnetsClient
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmSubnetServiceEndpointStoragePolicy() *schema.Resource {
func resourceSubnetServiceEndpointStoragePolicy() *schema.Resource {
return &schema.Resource{
Create: resourceArmSubnetServiceEndpointStoragePolicyCreateUpdate,
Read: resourceArmSubnetServiceEndpointStoragePolicyRead,
Update: resourceArmSubnetServiceEndpointStoragePolicyCreateUpdate,
Delete: resourceArmSubnetServiceEndpointStoragePolicyDelete,
Create: resourceSubnetServiceEndpointStoragePolicyCreateUpdate,
Read: resourceSubnetServiceEndpointStoragePolicyRead,
Update: resourceSubnetServiceEndpointStoragePolicyCreateUpdate,
Delete: resourceSubnetServiceEndpointStoragePolicyDelete,

Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error {
_, err := parse.SubnetServiceEndpointStoragePolicyID(id)
Expand Down Expand Up @@ -94,7 +94,7 @@ func resourceArmSubnetServiceEndpointStoragePolicy() *schema.Resource {
}
}

func resourceArmSubnetServiceEndpointStoragePolicyCreateUpdate(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetServiceEndpointStoragePolicyCreateUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.ServiceEndpointPoliciesClient
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d)
Expand Down Expand Up @@ -134,10 +134,10 @@ func resourceArmSubnetServiceEndpointStoragePolicyCreateUpdate(d *schema.Resourc

d.SetId(resourceId.ID())

return resourceArmSubnetServiceEndpointStoragePolicyRead(d, meta)
return resourceSubnetServiceEndpointStoragePolicyRead(d, meta)
}

func resourceArmSubnetServiceEndpointStoragePolicyRead(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetServiceEndpointStoragePolicyRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.ServiceEndpointPoliciesClient
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -172,7 +172,7 @@ func resourceArmSubnetServiceEndpointStoragePolicyRead(d *schema.ResourceData, m
return tags.FlattenAndSet(d, resp.Tags)
}

func resourceArmSubnetServiceEndpointStoragePolicyDelete(d *schema.ResourceData, meta interface{}) error {
func resourceSubnetServiceEndpointStoragePolicyDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.ServiceEndpointPoliciesClient
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down
Loading

0 comments on commit 7b120be

Please sign in to comment.