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

Add resources azurerm_virtual_network_gateway and azurerm_virtual_network_gateway_connection #133

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1f79d31
Add resources azurerm_virtual_network_gateway and azurerm_virtual_net…
dominik-lekse Jun 26, 2017
2087dd7
Adapt resources azurerm_virtual_network_gateway and azurerm_virtual_n…
dominik-lekse Jun 26, 2017
a236467
Applied review feedback to azurerm_virtual_network_gateway and azurer…
dominik-lekse Jun 26, 2017
ee0bbe1
Add support for latest skus in azurerm_virtual_network_gateway
dominik-lekse Jun 26, 2017
b89586f
Fixed validation of skus in azurerm_virtual_network_gateway
dominik-lekse Jun 26, 2017
2990404
Merge branch 'master' into feature/virtual-network-gateway
dominik-lekse Aug 5, 2017
c6ec4bc
Revised resources azurerm_virtual_network_gateway and azurerm_virtual…
dominik-lekse Aug 5, 2017
554046a
Fixed import tests TestAccAzureRMVirtualNetworkGateway_importBasic an…
dominik-lekse Aug 5, 2017
b4143ba
Merge branch 'master' into feature/virtual-network-gateway
dominik-lekse Sep 16, 2017
b06dd57
Fixed description of field authorization_key in documentation of reso…
dominik-lekse Sep 17, 2017
f07a31c
virtual_network_gateway_connection: Removed reading parameters which …
dominik-lekse Sep 17, 2017
0325c74
virtual_network_gateway: Removed comments on subnet deletion workaround
dominik-lekse Sep 17, 2017
1686272
Revised test for resources virtual_network_gateway and virtual_networ…
dominik-lekse Sep 17, 2017
ed51416
Merge branch 'master' into feature/virtual-network-gateway
dominik-lekse Sep 30, 2017
9739bc1
Merge branch 'master' into feature/virtual-network-gateway
dominik-lekse Oct 31, 2017
f95bf5d
azurer_virtual_network_gateway: Ignore case for subnet_id
dominik-lekse Oct 31, 2017
26b1d69
Merge branch 'master' into feature/virtual-network-gateway
dominik-lekse Jan 23, 2018
4baf7e5
Migrated resources virtual_network_gateway and virtual_network_gatewa…
dominik-lekse Jan 23, 2018
d724fd7
Migrated acceptance tests for resources virtual_network_gateway and v…
dominik-lekse Jan 24, 2018
8fcfc41
Merge branch 'master' into feature/virtual-network-gateway
dominik-lekse Jan 25, 2018
51614e0
Minor refactoring
tombuildsstuff Jan 25, 2018
d94db0f
Making the `vpn_client_configuration` a list
tombuildsstuff Jan 25, 2018
1b6ddaa
Crash protection for importing legacy resources
tombuildsstuff Jan 25, 2018
81a63b6
Refactoring to make `bgp_settings` a List
tombuildsstuff Jan 25, 2018
6b2f496
Fixing minor linting issues
tombuildsstuff Jan 25, 2018
19eb152
Working around a golint bug in the VNG acctests
tombuildsstuff Jan 25, 2018
f82fdd1
Adding validation to match the Azure Portal
tombuildsstuff Jan 25, 2018
66e4602
Adding a test covering updating the shared key
tombuildsstuff Jan 26, 2018
5046f19
Consistency in the documentation for VNG's/VNG Connections
tombuildsstuff Jan 26, 2018
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
32 changes: 32 additions & 0 deletions azurerm/import_arm_virtual_network_gateway_connection_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package azurerm

import (
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccAzureRMVirtualNetworkGatewayConnection_importSiteToSite(t *testing.T) {
resourceName := "azurerm_virtual_network_gateway_connection.test"

ri := acctest.RandInt()
config := testAccAzureRMVirtualNetworkGatewayConnection_sitetosite(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMVirtualNetworkGatewayConnectionDestroy,
Steps: []resource.TestStep{
{
Config: config,
},

{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
32 changes: 32 additions & 0 deletions azurerm/import_arm_virtual_network_gateway_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package azurerm

import (
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccAzureRMVirtualNetworkGateway_importBasic(t *testing.T) {
resourceName := "azurerm_virtual_network_gateway.test"

ri := acctest.RandInt()
config := testAccAzureRMVirtualNetworkGateway_basic(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMVirtualNetworkGatewayDestroy,
Steps: []resource.TestStep{
{
Config: config,
},

{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
186 changes: 94 additions & 92 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,98 +86,100 @@ func Provider() terraform.ResourceProvider {
},

ResourcesMap: map[string]*schema.Resource{
"azurerm_application_gateway": resourceArmApplicationGateway(),
"azurerm_application_insights": resourceArmApplicationInsights(),
"azurerm_app_service": resourceArmAppService(),
"azurerm_app_service_plan": resourceArmAppServicePlan(),
"azurerm_automation_account": resourceArmAutomationAccount(),
"azurerm_automation_credential": resourceArmAutomationCredential(),
"azurerm_automation_runbook": resourceArmAutomationRunbook(),
"azurerm_automation_schedule": resourceArmAutomationSchedule(),
"azurerm_availability_set": resourceArmAvailabilitySet(),
"azurerm_cdn_endpoint": resourceArmCdnEndpoint(),
"azurerm_cdn_profile": resourceArmCdnProfile(),
"azurerm_container_registry": resourceArmContainerRegistry(),
"azurerm_container_service": resourceArmContainerService(),
"azurerm_container_group": resourceArmContainerGroup(),
"azurerm_cosmosdb_account": resourceArmCosmosDBAccount(),
"azurerm_dns_a_record": resourceArmDnsARecord(),
"azurerm_dns_aaaa_record": resourceArmDnsAAAARecord(),
"azurerm_dns_cname_record": resourceArmDnsCNameRecord(),
"azurerm_dns_mx_record": resourceArmDnsMxRecord(),
"azurerm_dns_ns_record": resourceArmDnsNsRecord(),
"azurerm_dns_ptr_record": resourceArmDnsPtrRecord(),
"azurerm_dns_srv_record": resourceArmDnsSrvRecord(),
"azurerm_dns_txt_record": resourceArmDnsTxtRecord(),
"azurerm_dns_zone": resourceArmDnsZone(),
"azurerm_eventgrid_topic": resourceArmEventGridTopic(),
"azurerm_eventhub": resourceArmEventHub(),
"azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(),
"azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(),
"azurerm_eventhub_namespace": resourceArmEventHubNamespace(),
"azurerm_express_route_circuit": resourceArmExpressRouteCircuit(),
"azurerm_function_app": resourceArmFunctionApp(),
"azurerm_image": resourceArmImage(),
"azurerm_key_vault": resourceArmKeyVault(),
"azurerm_key_vault_certificate": resourceArmKeyVaultCertificate(),
"azurerm_key_vault_key": resourceArmKeyVaultKey(),
"azurerm_key_vault_secret": resourceArmKeyVaultSecret(),
"azurerm_lb": resourceArmLoadBalancer(),
"azurerm_lb_backend_address_pool": resourceArmLoadBalancerBackendAddressPool(),
"azurerm_lb_nat_rule": resourceArmLoadBalancerNatRule(),
"azurerm_lb_nat_pool": resourceArmLoadBalancerNatPool(),
"azurerm_lb_probe": resourceArmLoadBalancerProbe(),
"azurerm_lb_rule": resourceArmLoadBalancerRule(),
"azurerm_local_network_gateway": resourceArmLocalNetworkGateway(),
"azurerm_log_analytics_workspace": resourceArmLogAnalyticsWorkspace(),
"azurerm_managed_disk": resourceArmManagedDisk(),
"azurerm_management_lock": resourceArmManagementLock(),
"azurerm_metric_alertrule": resourceArmMetricAlertRule(),
"azurerm_mysql_configuration": resourceArmMySQLConfiguration(),
"azurerm_mysql_database": resourceArmMySqlDatabase(),
"azurerm_mysql_firewall_rule": resourceArmMySqlFirewallRule(),
"azurerm_mysql_server": resourceArmMySqlServer(),
"azurerm_network_interface": resourceArmNetworkInterface(),
"azurerm_network_security_group": resourceArmNetworkSecurityGroup(),
"azurerm_network_security_rule": resourceArmNetworkSecurityRule(),
"azurerm_network_watcher": resourceArmNetworkWatcher(),
"azurerm_postgresql_configuration": resourceArmPostgreSQLConfiguration(),
"azurerm_postgresql_database": resourceArmPostgreSQLDatabase(),
"azurerm_postgresql_firewall_rule": resourceArmPostgreSQLFirewallRule(),
"azurerm_postgresql_server": resourceArmPostgreSQLServer(),
"azurerm_public_ip": resourceArmPublicIp(),
"azurerm_redis_cache": resourceArmRedisCache(),
"azurerm_redis_firewall_rule": resourceArmRedisFirewallRule(),
"azurerm_resource_group": resourceArmResourceGroup(),
"azurerm_role_assignment": resourceArmRoleAssignment(),
"azurerm_role_definition": resourceArmRoleDefinition(),
"azurerm_route": resourceArmRoute(),
"azurerm_route_table": resourceArmRouteTable(),
"azurerm_search_service": resourceArmSearchService(),
"azurerm_servicebus_namespace": resourceArmServiceBusNamespace(),
"azurerm_servicebus_queue": resourceArmServiceBusQueue(),
"azurerm_servicebus_subscription": resourceArmServiceBusSubscription(),
"azurerm_servicebus_topic": resourceArmServiceBusTopic(),
"azurerm_snapshot": resourceArmSnapshot(),
"azurerm_sql_database": resourceArmSqlDatabase(),
"azurerm_sql_elasticpool": resourceArmSqlElasticPool(),
"azurerm_sql_firewall_rule": resourceArmSqlFirewallRule(),
"azurerm_sql_server": resourceArmSqlServer(),
"azurerm_storage_account": resourceArmStorageAccount(),
"azurerm_storage_blob": resourceArmStorageBlob(),
"azurerm_storage_container": resourceArmStorageContainer(),
"azurerm_storage_share": resourceArmStorageShare(),
"azurerm_storage_queue": resourceArmStorageQueue(),
"azurerm_storage_table": resourceArmStorageTable(),
"azurerm_subnet": resourceArmSubnet(),
"azurerm_template_deployment": resourceArmTemplateDeployment(),
"azurerm_traffic_manager_endpoint": resourceArmTrafficManagerEndpoint(),
"azurerm_traffic_manager_profile": resourceArmTrafficManagerProfile(),
"azurerm_virtual_machine_extension": resourceArmVirtualMachineExtensions(),
"azurerm_virtual_machine": resourceArmVirtualMachine(),
"azurerm_virtual_machine_scale_set": resourceArmVirtualMachineScaleSet(),
"azurerm_virtual_network": resourceArmVirtualNetwork(),
"azurerm_virtual_network_peering": resourceArmVirtualNetworkPeering(),
"azurerm_application_gateway": resourceArmApplicationGateway(),
"azurerm_application_insights": resourceArmApplicationInsights(),
"azurerm_app_service": resourceArmAppService(),
"azurerm_app_service_plan": resourceArmAppServicePlan(),
"azurerm_automation_account": resourceArmAutomationAccount(),
"azurerm_automation_credential": resourceArmAutomationCredential(),
"azurerm_automation_runbook": resourceArmAutomationRunbook(),
"azurerm_automation_schedule": resourceArmAutomationSchedule(),
"azurerm_availability_set": resourceArmAvailabilitySet(),
"azurerm_cdn_endpoint": resourceArmCdnEndpoint(),
"azurerm_cdn_profile": resourceArmCdnProfile(),
"azurerm_container_registry": resourceArmContainerRegistry(),
"azurerm_container_service": resourceArmContainerService(),
"azurerm_container_group": resourceArmContainerGroup(),
"azurerm_cosmosdb_account": resourceArmCosmosDBAccount(),
"azurerm_dns_a_record": resourceArmDnsARecord(),
"azurerm_dns_aaaa_record": resourceArmDnsAAAARecord(),
"azurerm_dns_cname_record": resourceArmDnsCNameRecord(),
"azurerm_dns_mx_record": resourceArmDnsMxRecord(),
"azurerm_dns_ns_record": resourceArmDnsNsRecord(),
"azurerm_dns_ptr_record": resourceArmDnsPtrRecord(),
"azurerm_dns_srv_record": resourceArmDnsSrvRecord(),
"azurerm_dns_txt_record": resourceArmDnsTxtRecord(),
"azurerm_dns_zone": resourceArmDnsZone(),
"azurerm_eventgrid_topic": resourceArmEventGridTopic(),
"azurerm_eventhub": resourceArmEventHub(),
"azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(),
"azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(),
"azurerm_eventhub_namespace": resourceArmEventHubNamespace(),
"azurerm_express_route_circuit": resourceArmExpressRouteCircuit(),
"azurerm_function_app": resourceArmFunctionApp(),
"azurerm_image": resourceArmImage(),
"azurerm_key_vault": resourceArmKeyVault(),
"azurerm_key_vault_certificate": resourceArmKeyVaultCertificate(),
"azurerm_key_vault_key": resourceArmKeyVaultKey(),
"azurerm_key_vault_secret": resourceArmKeyVaultSecret(),
"azurerm_lb": resourceArmLoadBalancer(),
"azurerm_lb_backend_address_pool": resourceArmLoadBalancerBackendAddressPool(),
"azurerm_lb_nat_rule": resourceArmLoadBalancerNatRule(),
"azurerm_lb_nat_pool": resourceArmLoadBalancerNatPool(),
"azurerm_lb_probe": resourceArmLoadBalancerProbe(),
"azurerm_lb_rule": resourceArmLoadBalancerRule(),
"azurerm_local_network_gateway": resourceArmLocalNetworkGateway(),
"azurerm_log_analytics_workspace": resourceArmLogAnalyticsWorkspace(),
"azurerm_managed_disk": resourceArmManagedDisk(),
"azurerm_management_lock": resourceArmManagementLock(),
"azurerm_metric_alertrule": resourceArmMetricAlertRule(),
"azurerm_mysql_configuration": resourceArmMySQLConfiguration(),
"azurerm_mysql_database": resourceArmMySqlDatabase(),
"azurerm_mysql_firewall_rule": resourceArmMySqlFirewallRule(),
"azurerm_mysql_server": resourceArmMySqlServer(),
"azurerm_network_interface": resourceArmNetworkInterface(),
"azurerm_network_security_group": resourceArmNetworkSecurityGroup(),
"azurerm_network_security_rule": resourceArmNetworkSecurityRule(),
"azurerm_network_watcher": resourceArmNetworkWatcher(),
"azurerm_postgresql_configuration": resourceArmPostgreSQLConfiguration(),
"azurerm_postgresql_database": resourceArmPostgreSQLDatabase(),
"azurerm_postgresql_firewall_rule": resourceArmPostgreSQLFirewallRule(),
"azurerm_postgresql_server": resourceArmPostgreSQLServer(),
"azurerm_public_ip": resourceArmPublicIp(),
"azurerm_redis_cache": resourceArmRedisCache(),
"azurerm_redis_firewall_rule": resourceArmRedisFirewallRule(),
"azurerm_resource_group": resourceArmResourceGroup(),
"azurerm_role_assignment": resourceArmRoleAssignment(),
"azurerm_role_definition": resourceArmRoleDefinition(),
"azurerm_route": resourceArmRoute(),
"azurerm_route_table": resourceArmRouteTable(),
"azurerm_search_service": resourceArmSearchService(),
"azurerm_servicebus_namespace": resourceArmServiceBusNamespace(),
"azurerm_servicebus_queue": resourceArmServiceBusQueue(),
"azurerm_servicebus_subscription": resourceArmServiceBusSubscription(),
"azurerm_servicebus_topic": resourceArmServiceBusTopic(),
"azurerm_snapshot": resourceArmSnapshot(),
"azurerm_sql_database": resourceArmSqlDatabase(),
"azurerm_sql_elasticpool": resourceArmSqlElasticPool(),
"azurerm_sql_firewall_rule": resourceArmSqlFirewallRule(),
"azurerm_sql_server": resourceArmSqlServer(),
"azurerm_storage_account": resourceArmStorageAccount(),
"azurerm_storage_blob": resourceArmStorageBlob(),
"azurerm_storage_container": resourceArmStorageContainer(),
"azurerm_storage_share": resourceArmStorageShare(),
"azurerm_storage_queue": resourceArmStorageQueue(),
"azurerm_storage_table": resourceArmStorageTable(),
"azurerm_subnet": resourceArmSubnet(),
"azurerm_template_deployment": resourceArmTemplateDeployment(),
"azurerm_traffic_manager_endpoint": resourceArmTrafficManagerEndpoint(),
"azurerm_traffic_manager_profile": resourceArmTrafficManagerProfile(),
"azurerm_virtual_machine_extension": resourceArmVirtualMachineExtensions(),
"azurerm_virtual_machine": resourceArmVirtualMachine(),
"azurerm_virtual_machine_scale_set": resourceArmVirtualMachineScaleSet(),
"azurerm_virtual_network": resourceArmVirtualNetwork(),
"azurerm_virtual_network_gateway": resourceArmVirtualNetworkGateway(),
"azurerm_virtual_network_gateway_connection": resourceArmVirtualNetworkGatewayConnection(),
"azurerm_virtual_network_peering": resourceArmVirtualNetworkPeering(),
},
}

Expand Down
19 changes: 13 additions & 6 deletions azurerm/resource_arm_local_network_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ func resourceArmLocalNetworkGatewayRead(d *schema.ResourceData, meta interface{}
client := meta.(*ArmClient).localNetConnClient
ctx := meta.(*ArmClient).StopContext

id, err := parseAzureResourceID(d.Id())
resGroup, name, err := resourceGroupAndLocalNetworkGatewayFromId(d.Id())
if err != nil {
return err
}
name := id.Path["localNetworkGateways"]
resGroup := id.ResourceGroup

resp, err := client.Get(ctx, resGroup, name)
if err != nil {
Expand Down Expand Up @@ -175,12 +173,10 @@ func resourceArmLocalNetworkGatewayDelete(d *schema.ResourceData, meta interface
client := meta.(*ArmClient).localNetConnClient
ctx := meta.(*ArmClient).StopContext

id, err := parseAzureResourceID(d.Id())
resGroup, name, err := resourceGroupAndLocalNetworkGatewayFromId(d.Id())
if err != nil {
return err
}
name := id.Path["localNetworkGateways"]
resGroup := id.ResourceGroup

future, err := client.Delete(ctx, resGroup, name)
if err != nil {
Expand All @@ -203,6 +199,17 @@ func resourceArmLocalNetworkGatewayDelete(d *schema.ResourceData, meta interface
return nil
}

func resourceGroupAndLocalNetworkGatewayFromId(localNetworkGatewayId string) (string, string, error) {
id, err := parseAzureResourceID(localNetworkGatewayId)
if err != nil {
return "", "", err
}
name := id.Path["localNetworkGateways"]
resGroup := id.ResourceGroup

return resGroup, name, nil
}

func expandLocalNetworkGatewayBGPSettings(d *schema.ResourceData) (*network.BgpSettings, error) {
v, exists := d.GetOk("bgp_settings")
if !exists {
Expand Down
Loading