From 41727bf06aa88e2aa6e8cbd41b629fcb447ed2cd Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 10:07:11 +0100 Subject: [PATCH 01/19] initial changes --- .ideas/.terraform.tfstate.lock.info | 1 + .ideas/simpleGolangTest/test.go | 94 ++++++++++ .ideas/test.tf | 43 +++++ azurerm/config.go | 9 + azurerm/provider.go | 1 + azurerm/resource_arm_bastion_host.go | 203 ++++++++++++++++++++++ azurerm/resource_arm_bastion_host_test.go | 82 +++++++++ go.mod | 12 +- go.sum | 55 ++++++ website/docs/r/bastion_host.html.markdown | 89 ++++++++++ 10 files changed, 585 insertions(+), 4 deletions(-) create mode 100644 .ideas/.terraform.tfstate.lock.info create mode 100644 .ideas/simpleGolangTest/test.go create mode 100644 .ideas/test.tf create mode 100644 azurerm/resource_arm_bastion_host.go create mode 100644 azurerm/resource_arm_bastion_host_test.go create mode 100644 website/docs/r/bastion_host.html.markdown diff --git a/.ideas/.terraform.tfstate.lock.info b/.ideas/.terraform.tfstate.lock.info new file mode 100644 index 000000000000..318bc97f6505 --- /dev/null +++ b/.ideas/.terraform.tfstate.lock.info @@ -0,0 +1 @@ +{"ID":"8a55be88-7505-a286-7ae0-eda612b64709","Operation":"OperationTypeApply","Info":"","Who":"danielmabbett@DESKTOP-NAMVCHQ","Version":"0.12.5","Created":"2019-08-15T09:05:02.5686055Z","Path":"terraform.tfstate"} \ No newline at end of file diff --git a/.ideas/simpleGolangTest/test.go b/.ideas/simpleGolangTest/test.go new file mode 100644 index 000000000000..8a167c4241a1 --- /dev/null +++ b/.ideas/simpleGolangTest/test.go @@ -0,0 +1,94 @@ +package main + +import ( + // "fmt" + "log" + "context" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/autorest/azure/auth" + // "encoding/json" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" +) + +func main() { + // create() + delete() +} + +func create() { + // client := network.NewBastionHostsClient("4b89b857-a820-4f5e-b02a-da6d5e180752") + + + log.Println("[INFO] preparing arguments for Azure Bastion Host creation.") + + // resourceGroup := "test" + // name := "test" + location := "westeurope" + dnsName := "testasfqwf" + subID := "subid" + pipID := "pip" + + subnetID := network.SubResource{ + ID: &subID, + } + + publicIPAddressID := network.SubResource{ + ID: &pipID, + } + + bastionHostIPConfigurationPropertiesFormat := network.BastionHostIPConfigurationPropertiesFormat{ + Subnet: &subnetID, + PublicIPAddress: &publicIPAddressID, + } + + bastionHostIPConfiguration := []network.BastionHostIPConfiguration{{ + Name: to.StringPtr("Name"), + BastionHostIPConfigurationPropertiesFormat: &bastionHostIPConfigurationPropertiesFormat, + }, + } + + properties := network.BastionHostPropertiesFormat{ + IPConfigurations: &bastionHostIPConfiguration, + DNSName: &dnsName, + } + + parameters := network.BastionHost{ + Location: &location, + BastionHostPropertiesFormat: &properties, + } + + j, _ := parameters.MarshalJSON() + log.Println(string(j)) + // // // creation + // // future, err := client.CreateOrUpdate(ctx, resourceGroup, name, parameters) + // // if err != nil { + // // return fmt.Errorf("Error creating/updating Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + // // return err + // // } + // // if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + // // return fmt.Errorf("Error waiting for creation/update of Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + // // } + // // // check presence + // // read, err := client.Get(ctx, resourceGroup, name) + // // if err != nil { + // // return fmt.Errorf("Error retrieving Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + // // } +} + +func delete() { + // create a VirtualNetworks client + client := network.NewBastionHostsClient("4b89b857-a820-4f5e-b02a-da6d5e180752") + ctx := context.Background() + + // create an authorizer from env vars or Azure Managed Service Idenity + authorizer, err := auth.NewAuthorizerFromCLI() + if err == nil { + client.Authorizer = authorizer + } + + s, err := client.Delete(ctx, "example-resources-2", "testbastion") + if err != nil { + log.Println(err) + } + log.Println(s) +} \ No newline at end of file diff --git a/.ideas/test.tf b/.ideas/test.tf new file mode 100644 index 000000000000..29d47279379a --- /dev/null +++ b/.ideas/test.tf @@ -0,0 +1,43 @@ +resource "azurerm_resource_group" "test" { + name = "example-resources-2" + location = "West Europe" +} + +resource "azurerm_virtual_network" "test" { + name = "testvnet" + address_space = ["192.168.1.0/24"] + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_subnet" "test" { + name = "AzureBastionSubnet" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "192.168.1.224/27" +} + +resource "azurerm_public_ip" "test" { + name = "testpip" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + allocation_method = "Static" + sku = "Standard" +} + +resource "azurerm_bastion_host" "test" { + name = "testbastion" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + ip_configuration { + name = "configuration" + subnet_id = "${azurerm_subnet.test.id}" + public_ip_address_id = "${azurerm_public_ip.test.id}" + } + + tags = { + environment = "dev" + location = "${azurerm_resource_group.test.location}" + } +} \ No newline at end of file diff --git a/azurerm/config.go b/azurerm/config.go index f736152ee45f..a9143ef0110f 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -16,6 +16,7 @@ import ( storeAccount "github.com/Azure/azure-sdk-for-go/services/datalake/store/mgmt/2016-11-01/account" "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-12-01/network" + network201906 "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights" "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql" MsSql "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-10-01-preview/sql" @@ -194,6 +195,10 @@ type ArmClient struct { applicationGatewayClient network.ApplicationGatewaysClient applicationSecurityGroupsClient network.ApplicationSecurityGroupsClient azureFirewallsClient network.AzureFirewallsClient + + // Bastion + bastionHostsClient network201906.BastionHostsClient + connectionMonitorsClient network.ConnectionMonitorsClient ddosProtectionPlanClient network.DdosProtectionPlansClient expressRouteAuthsClient network.ExpressRouteCircuitAuthorizationsClient @@ -566,6 +571,10 @@ func (c *ArmClient) registerNetworkingClients(endpoint, subscriptionId string, a c.configureClient(&azureFirewallsClient.Client, auth) c.azureFirewallsClient = azureFirewallsClient + bastionHostsClient := network201906.NewBastionHostsClientWithBaseURI(endpoint, subscriptionId) + c.configureClient(&bastionHostsClient.Client, auth) + c.bastionHostsClient = bastionHostsClient + connectionMonitorsClient := network.NewConnectionMonitorsClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&connectionMonitorsClient.Client, auth) c.connectionMonitorsClient = connectionMonitorsClient diff --git a/azurerm/provider.go b/azurerm/provider.go index 3369a680410a..2137c01a8d75 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -169,6 +169,7 @@ func Provider() terraform.ResourceProvider { "azurerm_azuread_application": resourceArmActiveDirectoryApplication(), "azurerm_azuread_service_principal_password": resourceArmActiveDirectoryServicePrincipalPassword(), "azurerm_azuread_service_principal": resourceArmActiveDirectoryServicePrincipal(), + "azurerm_bastion_host": resourceArmBastionHost(), "azurerm_batch_account": resourceArmBatchAccount(), "azurerm_batch_application": resourceArmBatchApplication(), "azurerm_batch_certificate": resourceArmBatchCertificate(), diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go new file mode 100644 index 000000000000..a839cc61811d --- /dev/null +++ b/azurerm/resource_arm_bastion_host.go @@ -0,0 +1,203 @@ +package azurerm + +import ( + "fmt" + "log" + + // "fmt" + // "regexp" + // "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" + "github.com/hashicorp/terraform/helper/schema" + + // "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" + // "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmBastionHost() *schema.Resource { + return &schema.Resource{ + Create: resourceArmBastionHostCreateUpdate, + Read: resourceArmBastionHostRead, + Update: resourceArmBastionHostCreateUpdate, + Delete: resourceArmBastionHostDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + // ValidateFunc: validateAzureRMBatchAccountName, + }, + + "location": azure.SchemaLocation(), + + // TODO: make this case sensitive once this API bug has been fixed: + // https://github.com/Azure/azure-rest-api-specs/issues/5574 + "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), + + "dns_name": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + + "ip_configuration": { + Type: schema.TypeList, + ForceNew: true, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "subnet_id": { + Type: schema.TypeString, + Required: true, + }, + "public_ip_address_id": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + + "tags": tagsSchema(), + }, + } +} + +func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).bastionHostsClient + ctx := meta.(*ArmClient).StopContext + + log.Println("[INFO] preparing arguments for Azure Bastion Host creation.") + + resourceGroup := d.Get("resource_group_name").(string) + name := d.Get("name").(string) + location := azure.NormalizeLocation(d.Get("location").(string)) + dnsName := d.Get("dns_name").(string) + tags := d.Get("tags").(map[string]interface{}) + + properties := d.Get("ip_configuration").([]interface{}) + firstProperty := properties[0].(map[string]interface{}) + ipConfName := firstProperty["name"].(string) + subID := firstProperty["subnet_id"].(string) + pipID := firstProperty["public_ip_address_id"].(string) + + // subnet and public ip resources + subnetID := network.SubResource{ + ID: &subID, + } + + publicIPAddressID := network.SubResource{ + ID: &pipID, + } + + // TODO: other ideas include creation some expansion function to return a usable list of bastion host properties + // pTest := expandBastionHostProperties(p) + + bastionHostIPConfigurationPropertiesFormat := network.BastionHostIPConfigurationPropertiesFormat{ + Subnet: &subnetID, + PublicIPAddress: &publicIPAddressID, + } + + bastionHostIPConfiguration := []network.BastionHostIPConfiguration{ + { + Name: &ipConfName, + BastionHostIPConfigurationPropertiesFormat: &bastionHostIPConfigurationPropertiesFormat, + }, + } + + bastionHostProperties := network.BastionHostPropertiesFormat{ + IPConfigurations: &bastionHostIPConfiguration, + DNSName: &dnsName, + } + + parameters := network.BastionHost{ + Location: &location, + BastionHostPropertiesFormat: &bastionHostProperties, + Tags: expandTags(tags), + } + + // creation + future, err := client.CreateOrUpdate(ctx, resourceGroup, name, parameters) + if err != nil { + return fmt.Errorf("Error creating/updating Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("Error waiting for creation/update of Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + // check presence + read, err := client.Get(ctx, resourceGroup, name) + if err != nil { + return fmt.Errorf("Error retrieving Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + d.SetId(*read.ID) + + return resourceArmBastionHostRead(d, meta) +} + +func resourceArmBastionHostRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).bastionHostsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + name := id.Path["bastionHosts"] + resourceGroup := id.ResourceGroup + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + log.Printf("[DEBUG] Bastion Host %q was not found in Resource Group %q - removing from state!", name, resourceGroup) + return nil + } + return fmt.Errorf("Error reading the state of Bastion Host %q: %+v", name, err) + } + + flattenAndSetTags(d, resp.Tags) + + return nil +} + +func resourceArmBastionHostDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).bastionHostsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + // name := "testbastion" + name := id.Path["bastionHosts"] + resourceGroup := id.ResourceGroup + + future, err := client.Delete(ctx, resourceGroup, name) + if err != nil { + return fmt.Errorf("Error deleting Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + if !response.WasNotFound(future.Response()) { + return fmt.Errorf("Error waiting for deletion of Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + } + + return nil +} diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go new file mode 100644 index 000000000000..49fb3700d0fb --- /dev/null +++ b/azurerm/resource_arm_bastion_host_test.go @@ -0,0 +1,82 @@ +package azurerm + +import ( + "fmt" + "net/http" + "os" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) +func TestAccAzureRMBastionHost_basic(t *testing.T) { + resourceName := "azurerm_bastion_host.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMAvailabilitySet_basic(ri, testLocation()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAvailabilitySetDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMAvailabilitySetExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "platform_update_domain_count", "5"), + resource.TestCheckResourceAttr(resourceName, "platform_fault_domain_count", "3"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} +func testAccAzureRMAvailabilitySet_basic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "testvnet" + address_space = ["192.168.1.0/24"] + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_subnet" "test" { + name = "AzureBastionSubnet" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "192.168.1.224/27" +} + +resource "azurerm_public_ip" "test" { + name = "testpip" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + allocation_method = "Static" + sku = "Standard" +} + +resource "azurerm_bastion_host" "test" { + name = "testbastion%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + ip_configuration { + name = "configuration" + subnet_id = "${azurerm_subnet.test.id}" + public_ip_address_id = "${azurerm_public_ip.test.id}" + } +} +`, rInt, location, rInt) +} diff --git a/go.mod b/go.mod index 0f28b8e6d3e9..b813e17c1866 100644 --- a/go.mod +++ b/go.mod @@ -1,22 +1,26 @@ module github.com/terraform-providers/terraform-provider-azurerm require ( - github.com/Azure/azure-sdk-for-go v31.0.0+incompatible - github.com/Azure/go-autorest/autorest v0.3.0 - github.com/Azure/go-autorest/autorest/adal v0.1.0 + github.com/Azure/azure-sdk-for-go v32.3.0+incompatible + github.com/Azure/go-autorest/autorest v0.7.0 + github.com/Azure/go-autorest/autorest/adal v0.4.0 + github.com/Azure/go-autorest/autorest/azure/auth v0.1.0 // indirect github.com/Azure/go-autorest/autorest/date v0.1.0 + github.com/Masterminds/semver v1.4.2 // indirect github.com/davecgh/go-spew v1.1.1 github.com/dnaeon/go-vcr v1.0.1 // indirect + github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 // indirect github.com/google/uuid v1.1.1 github.com/hashicorp/go-azure-helpers v0.5.0 github.com/hashicorp/go-getter v1.3.0 github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-uuid v1.0.1 github.com/hashicorp/go-version v1.1.0 - github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/terraform v0.12.0 github.com/satori/go.uuid v1.2.0 github.com/satori/uuid v0.0.0-20160927100844-b061729afc07 + github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect + github.com/spf13/cobra v0.0.5 // indirect github.com/terraform-providers/terraform-provider-azuread v0.4.1-0.20190610202312-5a179146b9f9 github.com/tombuildsstuff/giovanni v0.3.0 golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284 diff --git a/go.sum b/go.sum index 4c5024cf1fab..380fb4d541ae 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,7 @@ cloud.google.com/go v0.36.0 h1:+aCSj7tOo2LODWVEuZDZeGCckdt6MlSF+X/rB3wUiS8= cloud.google.com/go v0.36.0/go.mod h1:RUoy9p/M4ge0HzT8L+SDZ8jg+Q6fth0CiBuhFJpSV40= contrib.go.opencensus.io/exporter/ocagent v0.4.2 h1:EjvhWhqxJpIUEBcTJoUDUyScfZ/30ehPEvDmvj9v4DA= contrib.go.opencensus.io/exporter/ocagent v0.4.2/go.mod h1:YuG83h+XWwqWjvCqn7vK4KSyLKhThY3+gNGQ37iS2V0= +contrib.go.opencensus.io/exporter/ocagent v0.4.6/go.mod h1:YuG83h+XWwqWjvCqn7vK4KSyLKhThY3+gNGQ37iS2V0= contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= contrib.go.opencensus.io/exporter/ocagent v0.5.0 h1:TKXjQSRS0/cCDrP7KvkgU6SmILtF/yV2TOs/02K/WZQ= contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0= @@ -14,6 +15,7 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= +git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/Azure/azure-sdk-for-go v21.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v29.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v30.0.0+incompatible h1:6o1Yzl7wTBYg+xw0pY4qnalaPmEQolubEEdepo1/kmI= @@ -22,21 +24,31 @@ github.com/Azure/azure-sdk-for-go v30.1.0+incompatible h1:HyYPft8wXpxMd0kfLtXo6e github.com/Azure/azure-sdk-for-go v30.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v31.0.0+incompatible h1:18nT+M3yxnWcO66yoJyomlCoKMu578UHh0DjJBA5c1M= github.com/Azure/azure-sdk-for-go v31.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v32.3.0+incompatible h1:cPbYVpshHJc/lWNk0Gzhf8SLN+7qpdb8RQnRh0gntcI= +github.com/Azure/azure-sdk-for-go v32.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-autorest v10.15.4+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v11.7.0+incompatible h1:gzma19dc9ejB75D90E5S+/wXouzpZyA+CV+/MJPSD/k= github.com/Azure/go-autorest v11.7.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v12.2.0+incompatible h1:2Fxszbg492oAJrcvJlgyVaTqnQYRkxmEK6VPCLLVpBI= github.com/Azure/go-autorest v12.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= github.com/Azure/go-autorest/autorest v0.3.0 h1:yOmXNB2qa2Kx40wMZB19YyafzjCHacXPk8u0neqa+M0= github.com/Azure/go-autorest/autorest v0.3.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= +github.com/Azure/go-autorest/autorest v0.7.0 h1:pFCkeZ7LNLSQJgtzIaXlUnIVBOiz+GRz3RRyrdb9xJY= +github.com/Azure/go-autorest/autorest v0.7.0/go.mod h1:io2I5Mipuszn4buXaxt/RzC43Yf6aBtkgyUFF2HBdLY= github.com/Azure/go-autorest/autorest/adal v0.1.0 h1:RSw/7EAullliqwkZvgIGDYZWQm1PGKXI8c4aY/87yuU= github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E= +github.com/Azure/go-autorest/autorest/adal v0.4.0 h1:e4yveyEm5WvJDtmxJCY8fW1d3MY7vlQw/dVgL7kEmAg= +github.com/Azure/go-autorest/autorest/adal v0.4.0/go.mod h1:n1iM1u+ZMYni6IIY+FB82IT/DbSdC3T3gO1qFQ/3jEw= +github.com/Azure/go-autorest/autorest/azure/auth v0.1.0 h1:YgO/vSnJEc76NLw2ecIXvXa8bDWiqf1pOJzARAoZsYU= +github.com/Azure/go-autorest/autorest/azure/auth v0.1.0/go.mod h1:Gf7/i2FUpyb/sGBLIFxTBzrNzBo7aPXXE3ZVeDRwdpM= github.com/Azure/go-autorest/autorest/azure/cli v0.1.0 h1:YTtBrcb6mhA+PoSW8WxFDoIIyjp13XqJeX80ssQtri4= github.com/Azure/go-autorest/autorest/azure/cli v0.1.0/go.mod h1:Dk8CUAt/b/PzkfeRsWzVG9Yj3ps8mS8ECztu43rdU8U= github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= github.com/Azure/go-autorest/autorest/mocks v0.1.0 h1:Kx+AUU2Te+A3JIyYn6Dfs+cFgx5XorQKuIXrZGoq/SI= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/to v0.2.0 h1:nQOZzFCudTh+TvquAtCRjM01VEYx85e9qbwt5ncW4L8= github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc= github.com/Azure/go-autorest/autorest/validation v0.1.0 h1:ISSNzGUh+ZSzizJWOWzs8bwpXIePbGLW4z/AmUFGH5A= @@ -45,11 +57,15 @@ github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1Gn github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= github.com/Azure/go-autorest/tracing v0.1.0 h1:TRBxC5Pj/fIuh4Qob0ZpkggbfT8RC0SubHbpV3p4/Vc= github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88= +github.com/Azure/go-autorest/tracing v0.4.0 h1:r5D+n0u8XGFQIpIYk0xlKLDgiArnnIsfUjWANW5Wto0= +github.com/Azure/go-autorest/tracing v0.4.0/go.mod h1:sVZ/n8H0f4naUjHNvSe2qjNiC3oV6+8CCqU9mhEvav8= github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4 h1:pSm8mp0T2OH2CPmPDPtwHPr3VAQaOwVF/JbllOPP4xA= github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022 h1:y8Gs8CzNfDF5AZvjr+5UyGQvQEBL7pwo+v+wX6q9JI8= github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= +github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292 h1:tuQ7w+my8a8mkwN7x2TSd7OzTjkZ7rAeSyH4xncuAMI= @@ -75,6 +91,7 @@ github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2 github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 h1:7Ip0wMmLHLRJdrloDxZfhMm0xrLXZS8+COSu2bXmEQs= github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= @@ -108,10 +125,12 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -139,6 +158,8 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is= +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -193,8 +214,11 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmg github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.5.1/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/grpc-ecosystem/grpc-gateway v1.6.2/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.8.5 h1:2+KSC78XiO6Qy0hIjfc1OD9H+hsaJdJlb8Kqsd41CTE= github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/aws-sdk-go-base v0.2.0 h1:5bjZnWCvQg9Im5CHZr9t90IaFC4uvVlMl2fTh23IoCk= github.com/hashicorp/aws-sdk-go-base v0.2.0/go.mod h1:ZIWACGGi0N7a4DZbf15yuE1JQORmWLtBcVM6F5SXNFU= github.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089 h1:1eDpXAxTh0iPv+1kc9/gfSI2pxRERDsTk/lNGolwHn8= @@ -265,6 +289,7 @@ github.com/hashicorp/vault v0.10.4/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bA github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -295,6 +320,7 @@ github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lusis/go-artifactory v0.0.0-20160115162124-7e4ce345df82 h1:wnfcqULT+N2seWf6y4yHzmi7GD2kNx4Ute0qArktD48= github.com/lusis/go-artifactory v0.0.0-20160115162124-7e4ce345df82/go.mod h1:y54tfGmO3NKssKveTEFFzH8C/akrSOy/iW9qEAUDV84= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/marstr/guid v1.1.0 h1:/M4H/1G4avsieL6BbUwCOBzulmoeKVP5ux/3mQNnbyI= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9 h1:SmVbOZFWAlyQshuMfOkiAx1f5oUTsOGG5IXplAEYeeM= @@ -355,13 +381,16 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= +github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58 h1:m3CEgv3ah1Rhy82L+c0QG/U3VyY1UsvsIdkh0/rU97Y= github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.0.0-20170505043639-c605e284fe17 h1:chPfVn+gpAM5CTpTyVU9j8J+xgRGwmoDlNDLjKnJiYo= github.com/pkg/errors v0.0.0-20170505043639-c605e284fe17/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -389,6 +418,8 @@ github.com/satori/uuid v0.0.0-20160927100844-b061729afc07/go.mod h1:B8HLsPLik/YN github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= @@ -419,9 +450,17 @@ github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:X github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.1 h1:qgMbHoJbPbw579P+1zVY+6n4nIFuIchaIjzZ/I/Yq8M= github.com/spf13/afero v1.2.1/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -440,6 +479,7 @@ github.com/tombuildsstuff/giovanni v0.3.0 h1:uOaTgr6mp5iba02s+pz+ugBZuygIhA2tN+F github.com/tombuildsstuff/giovanni v0.3.0/go.mod h1:3UHcoRZCvWTjXMWCJ0epD1VROlPMwZeeof3vfP6NiWM= github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5 h1:cMjKdf4PxEBN9K5HaD9UMW8gkTbM0kMzkTa9SJe0WNQ= github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -450,6 +490,7 @@ github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0B github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557 h1:Jpn2j6wHkC9wJv5iMfJhKqrZJx3TahFx+7sbZ7zQdxs= github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/zclconf/go-cty v0.0.0-20181129180422-88fbe721e0f8/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v0.0.0-20190426224007-b18a157db9e2/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec h1:MSeYjmyjucsFbecMTxg63ASg23lcSARP/kr9sClTFfk= @@ -457,6 +498,8 @@ github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec/go.mod h1:xnAOWiHeO go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b h1:6ayHMBPtdP3jNuk+Sfhso+PTB7ZJQ5E1FBo403m2H8w= go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= +go.opencensus.io v0.19.1/go.mod h1:gug0GbSHa8Pafr0d2urOSgoXHZ6x/RUlaiT0d9pqb4A= +go.opencensus.io v0.19.2/go.mod h1:NO/8qkisMZLZ1FCsKNqtJPwc8/TaclWyY0B6wcYNg9M= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -472,16 +515,19 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869 h1:kkXA53yGe04D0adEYJwEVQjeBppL01Exg+fnMjfUraU= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284 h1:rlLehGeYg6jfoyz/eDqDU1iRXLKfR42nnNh57ytKEWo= golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -528,13 +574,16 @@ golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181218192612-074acd46bca6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -554,14 +603,18 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138 h1:H3uGjxCR/6Ds0Mjgyp7LMK81+LvmbvWWEnJhzk1Pi9E= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.1.0 h1:K6z2u68e86TPdSdefXdzvXgR1zEMa+459vBSfWYAZkI= google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= +google.golang.org/api v0.2.0/go.mod h1:IfRCZScioGtypHNTlz3gFk67J8uePVW7uDTBzXuIkhU= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0 h1:KKgc1aqhV8wDPbDzlDtpvyjZFY3vjz85FP7p4wcQUyI= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -574,6 +627,7 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= +google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922 h1:mBVYJnbrXLA/ZCBTCe7PtEgAUP+1bg92qTaFoPHdz+8= google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922/go.mod h1:L3J43x8/uS+qIUoksaLKe6OS3nUKxOKuIFz1sl2/jx4= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -605,6 +659,7 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= diff --git a/website/docs/r/bastion_host.html.markdown b/website/docs/r/bastion_host.html.markdown new file mode 100644 index 000000000000..1f425f6ca7e5 --- /dev/null +++ b/website/docs/r/bastion_host.html.markdown @@ -0,0 +1,89 @@ +--- +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_bastion_host" +sidebar_current: "docs-azurerm-resource-bastion-host-x" +description: |- + Manages a Bastion Host Instance. + +--- + +# azurerm_bastion_host + +Manages a Bastion Host Instance. + +## Example Usage + +This example deploys an Azure Bastion Host Instance to a target virtual network. + +```hcl +resource "azurerm_resource_group" "test" { + name = "example-resources-2" + location = "West Europe" +} + +resource "azurerm_virtual_network" "test" { + name = "testvnet" + address_space = ["192.168.1.0/24"] + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_subnet" "test" { + name = "AzureBastionSubnet" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "192.168.1.224/27" +} + +resource "azurerm_public_ip" "test" { + name = "testpip" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + allocation_method = "Static" + sku = "Standard" +} + +resource "azurerm_bastion_host" "test" { + name = "testbastion" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + ip_configuration { + name = "configuration" + subnet_id = "${azurerm_subnet.test.id}" + public_ip_address_id = "${azurerm_public_ip.test.id}" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name of the App Service. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the resource group in which to create the App Service. + +* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. + +* `ip_configuration` - (Required) A `ip_configuration` block as defined below. + +* `tags` - (Optional) A mapping of tags to assign to the resource. + +--- + +A `ip_configuration` block supports the following: + +* `name` - (Required) The Client ID of this relying party application. Enables OpenIDConnection authentication with Azure Active Directory. + +* `subnet_id` - (Required) The Client Secret of this relying party application. If no secret is provided, implicit flow will be used. + +* `public_ip_address_id` (Required) Allowed audience values to consider when validating JWTs issued by Azure Active Directory. + +## Import + +App Services can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_bastion_host.instance1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/instance1 +``` From 28058d6e2e8ef5f7fc4fdf6a005df7e53aac5615 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 10:21:12 +0100 Subject: [PATCH 02/19] go fmt --- .ideas/.terraform.tfstate.lock.info | 1 - .ideas/simpleGolangTest/test.go | 13 +++--- azurerm/config.go | 50 +++++++++++------------ azurerm/resource_arm_bastion_host.go | 24 +++++------ azurerm/resource_arm_bastion_host_test.go | 5 ++- 5 files changed, 46 insertions(+), 47 deletions(-) delete mode 100644 .ideas/.terraform.tfstate.lock.info diff --git a/.ideas/.terraform.tfstate.lock.info b/.ideas/.terraform.tfstate.lock.info deleted file mode 100644 index 318bc97f6505..000000000000 --- a/.ideas/.terraform.tfstate.lock.info +++ /dev/null @@ -1 +0,0 @@ -{"ID":"8a55be88-7505-a286-7ae0-eda612b64709","Operation":"OperationTypeApply","Info":"","Who":"danielmabbett@DESKTOP-NAMVCHQ","Version":"0.12.5","Created":"2019-08-15T09:05:02.5686055Z","Path":"terraform.tfstate"} \ No newline at end of file diff --git a/.ideas/simpleGolangTest/test.go b/.ideas/simpleGolangTest/test.go index 8a167c4241a1..e9c8d3991d3d 100644 --- a/.ideas/simpleGolangTest/test.go +++ b/.ideas/simpleGolangTest/test.go @@ -2,22 +2,21 @@ package main import ( // "fmt" - "log" "context" - "github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/azure/auth" + "github.com/Azure/go-autorest/autorest/to" + "log" // "encoding/json" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" ) func main() { - // create() + // create() delete() } func create() { // client := network.NewBastionHostsClient("4b89b857-a820-4f5e-b02a-da6d5e180752") - log.Println("[INFO] preparing arguments for Azure Bastion Host creation.") @@ -25,7 +24,7 @@ func create() { // name := "test" location := "westeurope" dnsName := "testasfqwf" - subID := "subid" + subID := "subid" pipID := "pip" subnetID := network.SubResource{ @@ -85,10 +84,10 @@ func delete() { if err == nil { client.Authorizer = authorizer } - + s, err := client.Delete(ctx, "example-resources-2", "testbastion") if err != nil { log.Println(err) } log.Println(s) -} \ No newline at end of file +} diff --git a/azurerm/config.go b/azurerm/config.go index a9143ef0110f..a8017164590b 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -196,31 +196,31 @@ type ArmClient struct { applicationSecurityGroupsClient network.ApplicationSecurityGroupsClient azureFirewallsClient network.AzureFirewallsClient - // Bastion - bastionHostsClient network201906.BastionHostsClient - - connectionMonitorsClient network.ConnectionMonitorsClient - ddosProtectionPlanClient network.DdosProtectionPlansClient - expressRouteAuthsClient network.ExpressRouteCircuitAuthorizationsClient - expressRouteCircuitClient network.ExpressRouteCircuitsClient - expressRoutePeeringsClient network.ExpressRouteCircuitPeeringsClient - ifaceClient network.InterfacesClient - loadBalancerClient network.LoadBalancersClient - localNetConnClient network.LocalNetworkGatewaysClient - netProfileClient network.ProfilesClient - packetCapturesClient network.PacketCapturesClient - publicIPClient network.PublicIPAddressesClient - publicIPPrefixClient network.PublicIPPrefixesClient - routesClient network.RoutesClient - routeTablesClient network.RouteTablesClient - secGroupClient network.SecurityGroupsClient - secRuleClient network.SecurityRulesClient - subnetClient network.SubnetsClient - vnetGatewayConnectionsClient network.VirtualNetworkGatewayConnectionsClient - vnetGatewayClient network.VirtualNetworkGatewaysClient - vnetClient network.VirtualNetworksClient - vnetPeeringsClient network.VirtualNetworkPeeringsClient - watcherClient network.WatchersClient + // Bastion + bastionHostsClient network201906.BastionHostsClient + + connectionMonitorsClient network.ConnectionMonitorsClient + ddosProtectionPlanClient network.DdosProtectionPlansClient + expressRouteAuthsClient network.ExpressRouteCircuitAuthorizationsClient + expressRouteCircuitClient network.ExpressRouteCircuitsClient + expressRoutePeeringsClient network.ExpressRouteCircuitPeeringsClient + ifaceClient network.InterfacesClient + loadBalancerClient network.LoadBalancersClient + localNetConnClient network.LocalNetworkGatewaysClient + netProfileClient network.ProfilesClient + packetCapturesClient network.PacketCapturesClient + publicIPClient network.PublicIPAddressesClient + publicIPPrefixClient network.PublicIPPrefixesClient + routesClient network.RoutesClient + routeTablesClient network.RouteTablesClient + secGroupClient network.SecurityGroupsClient + secRuleClient network.SecurityRulesClient + subnetClient network.SubnetsClient + vnetGatewayConnectionsClient network.VirtualNetworkGatewayConnectionsClient + vnetGatewayClient network.VirtualNetworkGatewaysClient + vnetClient network.VirtualNetworksClient + vnetPeeringsClient network.VirtualNetworkPeeringsClient + watcherClient network.WatchersClient // Resources managementLocksClient locks.ManagementLocksClient diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go index a839cc61811d..dfbcc262ee6c 100644 --- a/azurerm/resource_arm_bastion_host.go +++ b/azurerm/resource_arm_bastion_host.go @@ -82,16 +82,16 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} log.Println("[INFO] preparing arguments for Azure Bastion Host creation.") resourceGroup := d.Get("resource_group_name").(string) - name := d.Get("name").(string) - location := azure.NormalizeLocation(d.Get("location").(string)) - dnsName := d.Get("dns_name").(string) - tags := d.Get("tags").(map[string]interface{}) + name := d.Get("name").(string) + location := azure.NormalizeLocation(d.Get("location").(string)) + dnsName := d.Get("dns_name").(string) + tags := d.Get("tags").(map[string]interface{}) - properties := d.Get("ip_configuration").([]interface{}) + properties := d.Get("ip_configuration").([]interface{}) firstProperty := properties[0].(map[string]interface{}) - ipConfName := firstProperty["name"].(string) - subID := firstProperty["subnet_id"].(string) - pipID := firstProperty["public_ip_address_id"].(string) + ipConfName := firstProperty["name"].(string) + subID := firstProperty["subnet_id"].(string) + pipID := firstProperty["public_ip_address_id"].(string) // subnet and public ip resources subnetID := network.SubResource{ @@ -143,7 +143,7 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} if err != nil { return fmt.Errorf("Error retrieving Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) } - + d.SetId(*read.ID) return resourceArmBastionHostRead(d, meta) @@ -194,9 +194,9 @@ func resourceArmBastionHostDelete(d *schema.ResourceData, meta interface{}) erro } if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("Error waiting for deletion of Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) - } + if !response.WasNotFound(future.Response()) { + return fmt.Errorf("Error waiting for deletion of Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } } return nil diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go index 49fb3700d0fb..2675ec66b493 100644 --- a/azurerm/resource_arm_bastion_host_test.go +++ b/azurerm/resource_arm_bastion_host_test.go @@ -12,6 +12,7 @@ import ( "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) + func TestAccAzureRMBastionHost_basic(t *testing.T) { resourceName := "azurerm_bastion_host.test" ri := tf.AccRandTimeInt() @@ -26,8 +27,8 @@ func TestAccAzureRMBastionHost_basic(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMAvailabilitySetExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "platform_update_domain_count", "5"), - resource.TestCheckResourceAttr(resourceName, "platform_fault_domain_count", "3"), + //resource.TestCheckResourceAttr(resourceName, "platform_update_domain_count", "5"), + //resource.TestCheckResourceAttr(resourceName, "platform_fault_domain_count", "3"), ), }, { From 6e01472d34be58cce3f526313455d6f3c5bd9740 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 14:00:52 +0100 Subject: [PATCH 03/19] adding tests and links for website --- .ideas/test.tf | 7 +-- azurerm/resource_arm_bastion_host.go | 17 +++++- azurerm/resource_arm_bastion_host_test.go | 69 ++++++++++++++++++++--- go.sum | 1 + website/azurerm.erb | 4 ++ website/docs/r/bastion_host.html.markdown | 12 ++-- 6 files changed, 87 insertions(+), 23 deletions(-) diff --git a/.ideas/test.tf b/.ideas/test.tf index 29d47279379a..9d2aeab230a4 100644 --- a/.ideas/test.tf +++ b/.ideas/test.tf @@ -1,5 +1,5 @@ resource "azurerm_resource_group" "test" { - name = "example-resources-2" + name = "example-resources" location = "West Europe" } @@ -35,9 +35,4 @@ resource "azurerm_bastion_host" "test" { subnet_id = "${azurerm_subnet.test.id}" public_ip_address_id = "${azurerm_public_ip.test.id}" } - - tags = { - environment = "dev" - location = "${azurerm_resource_group.test.location}" - } } \ No newline at end of file diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go index dfbcc262ee6c..70113d44ff39 100644 --- a/azurerm/resource_arm_bastion_host.go +++ b/azurerm/resource_arm_bastion_host.go @@ -13,7 +13,7 @@ import ( // "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" - // "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -93,6 +93,20 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} subID := firstProperty["subnet_id"].(string) pipID := firstProperty["public_ip_address_id"].(string) + // Check if resources are to be imported + if requireResourcesToBeImported && d.IsNewResource() { + existing, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("Error checking for presence of existing Bastion Host %q (Resource Group %q): %s", name, resourceGroup, err) + } + } + + if existing.ID != nil && *existing.ID != "" { + return tf.ImportAsExistsError("azurerm_bastion_host", *existing.ID) + } + } + // subnet and public ip resources subnetID := network.SubResource{ ID: &subID, @@ -184,7 +198,6 @@ func resourceArmBastionHostDelete(d *schema.ResourceData, meta interface{}) erro return err } - // name := "testbastion" name := id.Path["bastionHosts"] resourceGroup := id.ResourceGroup diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go index 2675ec66b493..f3d042bae225 100644 --- a/azurerm/resource_arm_bastion_host_test.go +++ b/azurerm/resource_arm_bastion_host_test.go @@ -2,11 +2,11 @@ package azurerm import ( "fmt" - "net/http" - "os" + // "net/http" + // "os" "testing" - "github.com/hashicorp/terraform/helper/acctest" + // "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" @@ -16,19 +16,18 @@ import ( func TestAccAzureRMBastionHost_basic(t *testing.T) { resourceName := "azurerm_bastion_host.test" ri := tf.AccRandTimeInt() - config := testAccAzureRMAvailabilitySet_basic(ri, testLocation()) + // rs := acctest.RandString(4) + config := testAccAzureRMBastionHost_basic(ri, testLocation()) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testCheckAzureRMAvailabilitySetDestroy, + CheckDestroy: testCheckAzureRMBastionHostDestroy, Steps: []resource.TestStep{ { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMAvailabilitySetExists(resourceName), - //resource.TestCheckResourceAttr(resourceName, "platform_update_domain_count", "5"), - //resource.TestCheckResourceAttr(resourceName, "platform_fault_domain_count", "3"), + testCheckAzureRMBastionHostExists(resourceName), ), }, { @@ -39,7 +38,8 @@ func TestAccAzureRMBastionHost_basic(t *testing.T) { }, }) } -func testAccAzureRMAvailabilitySet_basic(rInt int, location string) string { + +func testAccAzureRMBastionHost_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" @@ -81,3 +81,54 @@ resource "azurerm_bastion_host" "test" { } `, rInt, location, rInt) } + +func testCheckAzureRMBastionHostExists(resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + client := testAccProvider.Meta().(*ArmClient).bastionHostsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("Not found: %q", resourceName) + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + resp, err := client.Get(ctx, resourceGroup, name) + + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Bad: Azure Bastion Host %q does not exist", rs.Primary.ID) + } + return fmt.Errorf("Bad: Get on Azure Bastion Host Client: %+v", err) + } + + return nil + } +} + +func testCheckAzureRMBastionHostDestroy(s *terraform.State) error { + client := testAccProvider.Meta().(*ArmClient).bastionHostsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_bastion_host" { + continue + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if !utils.ResponseWasNotFound(resp.Response) { + return err + } + } + + return nil + } + + return nil +} diff --git a/go.sum b/go.sum index 380fb4d541ae..4a5409f7bd2b 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,7 @@ github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZt github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= github.com/Azure/go-autorest/autorest/mocks v0.1.0 h1:Kx+AUU2Te+A3JIyYn6Dfs+cFgx5XorQKuIXrZGoq/SI= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0 h1:Ww5g4zThfD/6cLb4z6xxgeyDa7QDkizMkJKe0ysZXp0= github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/to v0.2.0 h1:nQOZzFCudTh+TvquAtCRjM01VEYx85e9qbwt5ncW4L8= github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc= diff --git a/website/azurerm.erb b/website/azurerm.erb index 8248333614e6..cf0a21141c4f 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -1315,6 +1315,10 @@ azurerm_connection_monitor +
  • + azurerm_bastion_host +
  • +
  • azurerm_network_connection_monitor
  • diff --git a/website/docs/r/bastion_host.html.markdown b/website/docs/r/bastion_host.html.markdown index 1f425f6ca7e5..1c6957cb4713 100644 --- a/website/docs/r/bastion_host.html.markdown +++ b/website/docs/r/bastion_host.html.markdown @@ -17,7 +17,7 @@ This example deploys an Azure Bastion Host Instance to a target virtual network. ```hcl resource "azurerm_resource_group" "test" { - name = "example-resources-2" + name = "example-resources" location = "West Europe" } @@ -74,16 +74,16 @@ The following arguments are supported: A `ip_configuration` block supports the following: -* `name` - (Required) The Client ID of this relying party application. Enables OpenIDConnection authentication with Azure Active Directory. +* `name` - (Required) The name of the IP configuration. -* `subnet_id` - (Required) The Client Secret of this relying party application. If no secret is provided, implicit flow will be used. +* `subnet_id` - (Required) The subnet ID for the IP configuration. -* `public_ip_address_id` (Required) Allowed audience values to consider when validating JWTs issued by Azure Active Directory. +* `public_ip_address_id` (Required) The public IP address ID for the IP configuration. ## Import -App Services can be imported using the `resource id`, e.g. +Bastion Hosts can be imported using the `resource id`, e.g. ```shell -terraform import azurerm_bastion_host.instance1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/instance1 +terraform import azurerm_bastion_host.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/bastionHosts/instance1 ``` From 689269bbcb012d5ad6371776706fa145d7d89c59 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 14:12:31 +0100 Subject: [PATCH 04/19] update markdown bastion host --- website/docs/r/bastion_host.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/r/bastion_host.html.markdown b/website/docs/r/bastion_host.html.markdown index 1c6957cb4713..2a31b69b9a29 100644 --- a/website/docs/r/bastion_host.html.markdown +++ b/website/docs/r/bastion_host.html.markdown @@ -76,9 +76,9 @@ A `ip_configuration` block supports the following: * `name` - (Required) The name of the IP configuration. -* `subnet_id` - (Required) The subnet ID for the IP configuration. +* `subnet_id` - (Required) Reference to a subnet in which this Bastion Host has been created. -* `public_ip_address_id` (Required) The public IP address ID for the IP configuration. +* `public_ip_address_id` (Required) Reference to a Public IP Address to associate with this Bastion Host. ## Import From 09eb3a28d9e5de64685dcfd29e1624d42c7ad06c Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 14:15:11 +0100 Subject: [PATCH 05/19] remove incompatible and unrequired files/folders --- .ideas/simpleGolangTest/test.go | 93 --------------------------------- .ideas/test.tf | 38 -------------- 2 files changed, 131 deletions(-) delete mode 100644 .ideas/simpleGolangTest/test.go delete mode 100644 .ideas/test.tf diff --git a/.ideas/simpleGolangTest/test.go b/.ideas/simpleGolangTest/test.go deleted file mode 100644 index e9c8d3991d3d..000000000000 --- a/.ideas/simpleGolangTest/test.go +++ /dev/null @@ -1,93 +0,0 @@ -package main - -import ( - // "fmt" - "context" - "github.com/Azure/go-autorest/autorest/azure/auth" - "github.com/Azure/go-autorest/autorest/to" - "log" - // "encoding/json" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" -) - -func main() { - // create() - delete() -} - -func create() { - // client := network.NewBastionHostsClient("4b89b857-a820-4f5e-b02a-da6d5e180752") - - log.Println("[INFO] preparing arguments for Azure Bastion Host creation.") - - // resourceGroup := "test" - // name := "test" - location := "westeurope" - dnsName := "testasfqwf" - subID := "subid" - pipID := "pip" - - subnetID := network.SubResource{ - ID: &subID, - } - - publicIPAddressID := network.SubResource{ - ID: &pipID, - } - - bastionHostIPConfigurationPropertiesFormat := network.BastionHostIPConfigurationPropertiesFormat{ - Subnet: &subnetID, - PublicIPAddress: &publicIPAddressID, - } - - bastionHostIPConfiguration := []network.BastionHostIPConfiguration{{ - Name: to.StringPtr("Name"), - BastionHostIPConfigurationPropertiesFormat: &bastionHostIPConfigurationPropertiesFormat, - }, - } - - properties := network.BastionHostPropertiesFormat{ - IPConfigurations: &bastionHostIPConfiguration, - DNSName: &dnsName, - } - - parameters := network.BastionHost{ - Location: &location, - BastionHostPropertiesFormat: &properties, - } - - j, _ := parameters.MarshalJSON() - log.Println(string(j)) - // // // creation - // // future, err := client.CreateOrUpdate(ctx, resourceGroup, name, parameters) - // // if err != nil { - // // return fmt.Errorf("Error creating/updating Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) - // // return err - // // } - // // if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - // // return fmt.Errorf("Error waiting for creation/update of Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) - // // } - // // // check presence - // // read, err := client.Get(ctx, resourceGroup, name) - // // if err != nil { - // // return fmt.Errorf("Error retrieving Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) - // // } -} - -func delete() { - // create a VirtualNetworks client - client := network.NewBastionHostsClient("4b89b857-a820-4f5e-b02a-da6d5e180752") - ctx := context.Background() - - // create an authorizer from env vars or Azure Managed Service Idenity - authorizer, err := auth.NewAuthorizerFromCLI() - if err == nil { - client.Authorizer = authorizer - } - - s, err := client.Delete(ctx, "example-resources-2", "testbastion") - if err != nil { - log.Println(err) - } - log.Println(s) -} diff --git a/.ideas/test.tf b/.ideas/test.tf deleted file mode 100644 index 9d2aeab230a4..000000000000 --- a/.ideas/test.tf +++ /dev/null @@ -1,38 +0,0 @@ -resource "azurerm_resource_group" "test" { - name = "example-resources" - location = "West Europe" -} - -resource "azurerm_virtual_network" "test" { - name = "testvnet" - address_space = ["192.168.1.0/24"] - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" -} - -resource "azurerm_subnet" "test" { - name = "AzureBastionSubnet" - resource_group_name = "${azurerm_resource_group.test.name}" - virtual_network_name = "${azurerm_virtual_network.test.name}" - address_prefix = "192.168.1.224/27" -} - -resource "azurerm_public_ip" "test" { - name = "testpip" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - allocation_method = "Static" - sku = "Standard" -} - -resource "azurerm_bastion_host" "test" { - name = "testbastion" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - - ip_configuration { - name = "configuration" - subnet_id = "${azurerm_subnet.test.id}" - public_ip_address_id = "${azurerm_public_ip.test.id}" - } -} \ No newline at end of file From 78a5dfe60f50a26bc8e26c5426b1c5afc04d9b28 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 14:19:54 +0100 Subject: [PATCH 06/19] add dns_name argument for bastion host --- website/docs/r/bastion_host.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/r/bastion_host.html.markdown b/website/docs/r/bastion_host.html.markdown index 2a31b69b9a29..8ddae943cd6e 100644 --- a/website/docs/r/bastion_host.html.markdown +++ b/website/docs/r/bastion_host.html.markdown @@ -66,6 +66,8 @@ The following arguments are supported: * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. +* `dns_name` - (Optional) Specifies the DNS prefix for the Bastion Host. + * `ip_configuration` - (Required) A `ip_configuration` block as defined below. * `tags` - (Optional) A mapping of tags to assign to the resource. From 155cb3983ba942c4e093125a17dfe06a4a90e947 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 14:26:04 +0100 Subject: [PATCH 07/19] cleanup --- azurerm/resource_arm_bastion_host_test.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go index f3d042bae225..3d0cb9da106c 100644 --- a/azurerm/resource_arm_bastion_host_test.go +++ b/azurerm/resource_arm_bastion_host_test.go @@ -16,7 +16,7 @@ import ( func TestAccAzureRMBastionHost_basic(t *testing.T) { resourceName := "azurerm_bastion_host.test" ri := tf.AccRandTimeInt() - // rs := acctest.RandString(4) + config := testAccAzureRMBastionHost_basic(ri, testLocation()) resource.ParallelTest(t, resource.TestCase{ @@ -30,11 +30,6 @@ func TestAccAzureRMBastionHost_basic(t *testing.T) { testCheckAzureRMBastionHostExists(resourceName), ), }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, }, }) } From f5a752bdd0e0be0a1fcbc051e8eaedf1979df747 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 14:30:32 +0100 Subject: [PATCH 08/19] cleanup bastion host test --- azurerm/resource_arm_bastion_host_test.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go index 3d0cb9da106c..da74eb947dc9 100644 --- a/azurerm/resource_arm_bastion_host_test.go +++ b/azurerm/resource_arm_bastion_host_test.go @@ -2,11 +2,8 @@ package azurerm import ( "fmt" - // "net/http" - // "os" "testing" - // "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" @@ -16,7 +13,7 @@ import ( func TestAccAzureRMBastionHost_basic(t *testing.T) { resourceName := "azurerm_bastion_host.test" ri := tf.AccRandTimeInt() - + config := testAccAzureRMBastionHost_basic(ri, testLocation()) resource.ParallelTest(t, resource.TestCase{ From 1edfd63659e03ea2e499dd5b43cc4e942f1b49e3 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 14:33:05 +0100 Subject: [PATCH 09/19] cleanup bastion host resource --- azurerm/resource_arm_bastion_host.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go index 70113d44ff39..f40fcfdab6c8 100644 --- a/azurerm/resource_arm_bastion_host.go +++ b/azurerm/resource_arm_bastion_host.go @@ -4,13 +4,9 @@ import ( "fmt" "log" - // "fmt" - // "regexp" - // "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" "github.com/hashicorp/terraform/helper/schema" - // "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" @@ -32,7 +28,6 @@ func resourceArmBastionHost() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - // ValidateFunc: validateAzureRMBatchAccountName, }, "location": azure.SchemaLocation(), From f15620c679767d8264c97a401c934427eb455d00 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 14:40:00 +0100 Subject: [PATCH 10/19] Seperate Bastion into Networking preview api --- azurerm/config.go | 51 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/azurerm/config.go b/azurerm/config.go index a8017164590b..7cc74e330c2c 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -191,36 +191,35 @@ type ArmClient struct { monitorLogProfilesClient insights.LogProfilesClient monitorMetricAlertsClient insights.MetricAlertsClient + // Networking - Preview Bastion + bastionHostsClient network201906.BastionHostsClient + // Networking applicationGatewayClient network.ApplicationGatewaysClient applicationSecurityGroupsClient network.ApplicationSecurityGroupsClient azureFirewallsClient network.AzureFirewallsClient - - // Bastion - bastionHostsClient network201906.BastionHostsClient - - connectionMonitorsClient network.ConnectionMonitorsClient - ddosProtectionPlanClient network.DdosProtectionPlansClient - expressRouteAuthsClient network.ExpressRouteCircuitAuthorizationsClient - expressRouteCircuitClient network.ExpressRouteCircuitsClient - expressRoutePeeringsClient network.ExpressRouteCircuitPeeringsClient - ifaceClient network.InterfacesClient - loadBalancerClient network.LoadBalancersClient - localNetConnClient network.LocalNetworkGatewaysClient - netProfileClient network.ProfilesClient - packetCapturesClient network.PacketCapturesClient - publicIPClient network.PublicIPAddressesClient - publicIPPrefixClient network.PublicIPPrefixesClient - routesClient network.RoutesClient - routeTablesClient network.RouteTablesClient - secGroupClient network.SecurityGroupsClient - secRuleClient network.SecurityRulesClient - subnetClient network.SubnetsClient - vnetGatewayConnectionsClient network.VirtualNetworkGatewayConnectionsClient - vnetGatewayClient network.VirtualNetworkGatewaysClient - vnetClient network.VirtualNetworksClient - vnetPeeringsClient network.VirtualNetworkPeeringsClient - watcherClient network.WatchersClient + connectionMonitorsClient network.ConnectionMonitorsClient + ddosProtectionPlanClient network.DdosProtectionPlansClient + expressRouteAuthsClient network.ExpressRouteCircuitAuthorizationsClient + expressRouteCircuitClient network.ExpressRouteCircuitsClient + expressRoutePeeringsClient network.ExpressRouteCircuitPeeringsClient + ifaceClient network.InterfacesClient + loadBalancerClient network.LoadBalancersClient + localNetConnClient network.LocalNetworkGatewaysClient + netProfileClient network.ProfilesClient + packetCapturesClient network.PacketCapturesClient + publicIPClient network.PublicIPAddressesClient + publicIPPrefixClient network.PublicIPPrefixesClient + routesClient network.RoutesClient + routeTablesClient network.RouteTablesClient + secGroupClient network.SecurityGroupsClient + secRuleClient network.SecurityRulesClient + subnetClient network.SubnetsClient + vnetGatewayConnectionsClient network.VirtualNetworkGatewayConnectionsClient + vnetGatewayClient network.VirtualNetworkGatewaysClient + vnetClient network.VirtualNetworksClient + vnetPeeringsClient network.VirtualNetworkPeeringsClient + watcherClient network.WatchersClient // Resources managementLocksClient locks.ManagementLocksClient From 016c73e9c9568a50fe96ef9f97fefd6f5fb3520f Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 15 Aug 2019 14:42:15 +0100 Subject: [PATCH 11/19] remove non-useful comments --- azurerm/resource_arm_bastion_host.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go index f40fcfdab6c8..970e0a677a52 100644 --- a/azurerm/resource_arm_bastion_host.go +++ b/azurerm/resource_arm_bastion_host.go @@ -111,9 +111,6 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} ID: &pipID, } - // TODO: other ideas include creation some expansion function to return a usable list of bastion host properties - // pTest := expandBastionHostProperties(p) - bastionHostIPConfigurationPropertiesFormat := network.BastionHostIPConfigurationPropertiesFormat{ Subnet: &subnetID, PublicIPAddress: &publicIPAddressID, From 29007a9ad784da1bd20fbb51d9f51979d5e214a4 Mon Sep 17 00:00:00 2001 From: Daniel Mabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Tue, 20 Aug 2019 11:45:40 +0100 Subject: [PATCH 12/19] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 8f196b110e0f..ceaf4ca20f54 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-uuid v1.0.1 github.com/hashicorp/go-version v1.1.0 - github.com/hashicorp/terraform v0.12.0 + github.com/hashicorp/terraform v0.12.6 github.com/hashicorp/hcl v1.0.0 // indirect github.com/satori/go.uuid v1.2.0 github.com/satori/uuid v0.0.0-20160927100844-b061729afc07 From 21f37e76622a1fa6745c35d2e9398c96042c99f9 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 3 Oct 2019 16:06:59 +0100 Subject: [PATCH 13/19] bastion: add expand and flatten for ipconfig. Fix typos and errs. Add import test --- azurerm/resource_arm_bastion_host.go | 160 +++++++++++++++------- azurerm/resource_arm_bastion_host_test.go | 57 +++++++- website/docs/r/bastion_host.html.markdown | 42 +++--- 3 files changed, 183 insertions(+), 76 deletions(-) diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go index 970e0a677a52..62f1f88ff171 100644 --- a/azurerm/resource_arm_bastion_host.go +++ b/azurerm/resource_arm_bastion_host.go @@ -3,6 +3,7 @@ package azurerm import ( "fmt" "log" + "regexp" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" "github.com/hashicorp/terraform/helper/schema" @@ -25,16 +26,15 @@ func resourceArmBastionHost() *schema.Resource { Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validateAzureRMBastionHostName, }, "location": azure.SchemaLocation(), - // TODO: make this case sensitive once this API bug has been fixed: - // https://github.com/Azure/azure-rest-api-specs/issues/5574 - "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), + "resource_group_name": azure.SchemaResourceGroupName(), "dns_name": { Type: schema.TypeString, @@ -54,18 +54,20 @@ func resourceArmBastionHost() *schema.Resource { Required: true, }, "subnet_id": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: azure.ValidateResourceID, }, "public_ip_address_id": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: azure.ValidateResourceID, }, }, }, }, - "tags": tagsSchema(), + "tags": tags.Schema(), }, } } @@ -82,11 +84,7 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} dnsName := d.Get("dns_name").(string) tags := d.Get("tags").(map[string]interface{}) - properties := d.Get("ip_configuration").([]interface{}) - firstProperty := properties[0].(map[string]interface{}) - ipConfName := firstProperty["name"].(string) - subID := firstProperty["subnet_id"].(string) - pipID := firstProperty["public_ip_address_id"].(string) + // properties := d.Get("ip_configuration").([]interface{}) // Check if resources are to be imported if requireResourcesToBeImported && d.IsNewResource() { @@ -102,39 +100,15 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} } } - // subnet and public ip resources - subnetID := network.SubResource{ - ID: &subID, - } - - publicIPAddressID := network.SubResource{ - ID: &pipID, - } - - bastionHostIPConfigurationPropertiesFormat := network.BastionHostIPConfigurationPropertiesFormat{ - Subnet: &subnetID, - PublicIPAddress: &publicIPAddressID, - } - - bastionHostIPConfiguration := []network.BastionHostIPConfiguration{ - { - Name: &ipConfName, - BastionHostIPConfigurationPropertiesFormat: &bastionHostIPConfigurationPropertiesFormat, - }, - } - - bastionHostProperties := network.BastionHostPropertiesFormat{ - IPConfigurations: &bastionHostIPConfiguration, - DNSName: &dnsName, - } - parameters := network.BastionHost{ - Location: &location, - BastionHostPropertiesFormat: &bastionHostProperties, - Tags: expandTags(tags), + Location: &location, + BastionHostPropertiesFormat: &network.BastionHostPropertiesFormat{ + IPConfigurations: expandArmBastionHostIpConfiguration(d.Get("ip_configuration").([]interface{})), + DNSName: &dnsName, + }, + Tags: expandTags(tags), } - // creation future, err := client.CreateOrUpdate(ctx, resourceGroup, name, parameters) if err != nil { return fmt.Errorf("Error creating/updating Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) @@ -144,7 +118,6 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error waiting for creation/update of Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) } - // check presence read, err := client.Get(ctx, resourceGroup, name) if err != nil { return fmt.Errorf("Error retrieving Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) @@ -159,10 +132,11 @@ func resourceArmBastionHostRead(d *schema.ResourceData, meta interface{}) error client := meta.(*ArmClient).bastionHostsClient ctx := meta.(*ArmClient).StopContext - id, err := parseAzureResourceID(d.Id()) + id, err := azure.ParseAzureResourceID(d.Id()) if err != nil { return err } + name := id.Path["bastionHosts"] resourceGroup := id.ResourceGroup @@ -176,9 +150,24 @@ func resourceArmBastionHostRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error reading the state of Bastion Host %q: %+v", name, err) } - flattenAndSetTags(d, resp.Tags) + d.Set("name", resp.Name) + d.Set("resource_group_name", resourceGroup) - return nil + if location := resp.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } + + if props := resp.BastionHostPropertiesFormat; props != nil { + if ipConfigs := props.FrontendIPConfigurations; ipConfigs != nil { + if err := d.Set("ip_configuration", flattenArmBastionHostIPConfiguration(ipConfigs)); err != nil { + return fmt.Errorf("Error flattening `ip_configuration`: %+v", err) + } + + d.Set("dns_name", props.DNSName) + } + } + + return tags.FlattenAndSet(d, resp.Tags) } func resourceArmBastionHostDelete(d *schema.ResourceData, meta interface{}) error { @@ -206,3 +195,74 @@ func resourceArmBastionHostDelete(d *schema.ResourceData, meta interface{}) erro return nil } + +func validateAzureRMBastionHostName(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf("lowercase letters, highercase letters numbers only are allowed in %q: %q", k, value)) + } + + if 1 > len(value) { + errors = append(errors, fmt.Errorf("%q cannot be less than 1 characters: %q", k, value)) + } + + if len(value) > 64 { + errors = append(errors, fmt.Errorf("%q cannot be longer than 64 characters: %q %d", k, value, len(value))) + } + + return warnings, errors +} + +// expandArmBastionHostIpConfiguration +func expandArmBastionHostIPConfiguration(input []interface{}) (ipConfigs *[]network.FrontendIPConfiguration, err error) { + if len(input) == 0 { + return nil, nil + } + + property := input[0].(map[string]interface{}) + ipConfName := property["name"].(string) + subID := property["subnet_id"].(string) + pipID := property["public_ip_address_id"].(string) + + return []network.BastionHostIPConfiguration{ + { + Name: &ipConfName, + BastionHostIPConfigurationPropertiesFormat: &network.BastionHostIPConfigurationPropertiesFormat{ + Subnet: &network.SubResource{ + ID: &subID, + }, + PublicIPAddress: &network.SubResource{ + ID: &pipID, + }, + }, + }, + }, nil +} + +func flattenArmBastionHostIPConfiguration(ipConfigs *[]network.FrontendIPConfiguration) []interface{} { + result := make([]interface{}, 0) + if ipConfigs == nil { + return result + } + + for _, config := range *ipConfigs { + ipConfig := make(map[string]interface{}) + + if config.Name != nil { + ipConfig["name"] = *config.Name + } + + if props := config.FrontendIPConfigurationPropertiesFormat; props != nil { + if subnet := props.Subnet; subnet != nil { + ipConfig["subnet_id"] = *subnet.ID + } + + if pip := props.PublicIPAddress; pip != nil { + ipConfig["public_ip_address_id"] = *pip.ID + } + } + + result = append(result, ipConfig) + } + return result +} diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go index da74eb947dc9..2dc533f7ad1d 100644 --- a/azurerm/resource_arm_bastion_host_test.go +++ b/azurerm/resource_arm_bastion_host_test.go @@ -31,6 +31,37 @@ func TestAccAzureRMBastionHost_basic(t *testing.T) { }) } +func TestAccAzureRMBatchAccount_requiresImport(t *testing.T) { + if !requireResourcesToBeImported { + t.Skip("Skipping since resources aren't required to be imported") + return + } + + resourceName := "azurerm_bastion_host.test" + ri := tf.AccRandTimeInt() + + rs := acctest.RandString(4) + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMBastionHostDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMBastionHost_basic(ri, rs, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMBastionHostExists(resourceName), + ), + }, + { + Config: testAccAzureRMBastionHost_requiresImport(ri, rs, location), + ExpectError: testRequiresImportError("azurerm_bastion_host"), + }, + }, + }) +} + func testAccAzureRMBastionHost_basic(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { @@ -39,7 +70,7 @@ resource "azurerm_resource_group" "test" { } resource "azurerm_virtual_network" "test" { - name = "testvnet" + name = "acctestVNet%d" address_space = ["192.168.1.0/24"] location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -53,7 +84,7 @@ resource "azurerm_subnet" "test" { } resource "azurerm_public_ip" "test" { - name = "testpip" + name = "acctestBastionPIP%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" allocation_method = "Static" @@ -61,7 +92,7 @@ resource "azurerm_public_ip" "test" { } resource "azurerm_bastion_host" "test" { - name = "testbastion%d" + name = "acctestBastion%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -71,7 +102,24 @@ resource "azurerm_bastion_host" "test" { public_ip_address_id = "${azurerm_public_ip.test.id}" } } -`, rInt, location, rInt) +`, rInt, location, rInt, rInt, rInt) +} + +func testAccAzureRMBastionHost_requiresImport(rInt int, location string) string { + template := testAccAzureRMBastionHost_basic(rInt, location) + return fmt.Sprintf(` +%s +resource "azurerm_bastion_host" "import" { + name = "${azurerm_batch_account.test.name}" + resource_group_name = "${azurerm_batch_account.test.resource_group_name}" + location = "${azurerm_batch_account.test.location}" + ip_configuration { + name = "configuration" + subnet_id = "${azurerm_subnet.test.id}" + public_ip_address_id = "${azurerm_public_ip.test.id}" + } +} +`, template) } func testCheckAzureRMBastionHostExists(resourceName string) resource.TestCheckFunc { @@ -88,7 +136,6 @@ func testCheckAzureRMBastionHostExists(resourceName string) resource.TestCheckFu resourceGroup := rs.Primary.Attributes["resource_group_name"] resp, err := client.Get(ctx, resourceGroup, name) - if err != nil { if utils.ResponseWasNotFound(resp.Response) { return fmt.Errorf("Bad: Azure Bastion Host %q does not exist", rs.Primary.ID) diff --git a/website/docs/r/bastion_host.html.markdown b/website/docs/r/bastion_host.html.markdown index 8ddae943cd6e..0dd3017cda20 100644 --- a/website/docs/r/bastion_host.html.markdown +++ b/website/docs/r/bastion_host.html.markdown @@ -16,42 +16,42 @@ Manages a Bastion Host Instance. This example deploys an Azure Bastion Host Instance to a target virtual network. ```hcl -resource "azurerm_resource_group" "test" { +resource "azurerm_resource_group" "example" { name = "example-resources" location = "West Europe" } -resource "azurerm_virtual_network" "test" { - name = "testvnet" +resource "azurerm_virtual_network" "example" { + name = "examplevnet" address_space = ["192.168.1.0/24"] - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.example.location}" + resource_group_name = "${azurerm_resource_group.example.name}" } -resource "azurerm_subnet" "test" { +resource "azurerm_subnet" "example" { name = "AzureBastionSubnet" - resource_group_name = "${azurerm_resource_group.test.name}" - virtual_network_name = "${azurerm_virtual_network.test.name}" + resource_group_name = "${azurerm_resource_group.example.name}" + virtual_network_name = "${azurerm_virtual_network.example.name}" address_prefix = "192.168.1.224/27" } -resource "azurerm_public_ip" "test" { - name = "testpip" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" +resource "azurerm_public_ip" "example" { + name = "examplepip" + location = "${azurerm_resource_group.example.location}" + resource_group_name = "${azurerm_resource_group.example.name}" allocation_method = "Static" sku = "Standard" } -resource "azurerm_bastion_host" "test" { - name = "testbastion" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" +resource "azurerm_bastion_host" "example" { + name = "examplebastion" + location = "${azurerm_resource_group.example.location}" + resource_group_name = "${azurerm_resource_group.example.name}" ip_configuration { name = "configuration" - subnet_id = "${azurerm_subnet.test.id}" - public_ip_address_id = "${azurerm_public_ip.test.id}" + subnet_id = "${azurerm_subnet.example.id}" + public_ip_address_id = "${azurerm_public_ip.example.id}" } } ``` @@ -60,9 +60,9 @@ resource "azurerm_bastion_host" "test" { The following arguments are supported: -* `name` - (Required) Specifies the name of the App Service. Changing this forces a new resource to be created. +* `name` - (Required) Specifies the name of the Bastion Host. Changing this forces a new resource to be created. -* `resource_group_name` - (Required) The name of the resource group in which to create the App Service. +* `resource_group_name` - (Required) The name of the resource group in which to create the Bastion Host. * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. @@ -87,5 +87,5 @@ A `ip_configuration` block supports the following: Bastion Hosts can be imported using the `resource id`, e.g. ```shell -terraform import azurerm_bastion_host.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/bastionHosts/instance1 +terraform import azurerm_bastion_host.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/bastionHosts/instance1 ``` From 6da56d052045777f4bfbb346e9355cf72309492c Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Mon, 7 Oct 2019 14:12:01 +0100 Subject: [PATCH 14/19] init --- azurerm/internal/services/network/client.go | 5 + azurerm/provider.go | 393 ++++++++++---------- azurerm/resource_arm_bastion_host.go | 268 +++++++++++++ azurerm/resource_arm_bastion_host_test.go | 244 ++++++++++++ go.mod | 1 + website/docs/r/bastion_host.html.markdown | 91 +++++ 6 files changed, 806 insertions(+), 196 deletions(-) create mode 100644 azurerm/resource_arm_bastion_host.go create mode 100644 azurerm/resource_arm_bastion_host_test.go create mode 100644 website/docs/r/bastion_host.html.markdown diff --git a/azurerm/internal/services/network/client.go b/azurerm/internal/services/network/client.go index cb4a6a8d5fe0..08009bf37426 100644 --- a/azurerm/internal/services/network/client.go +++ b/azurerm/internal/services/network/client.go @@ -9,6 +9,7 @@ type Client struct { ApplicationGatewaysClient *network.ApplicationGatewaysClient ApplicationSecurityGroupsClient *network.ApplicationSecurityGroupsClient AzureFirewallsClient *network.AzureFirewallsClient + BastionHostsClient *network.BastionHostsClient ConnectionMonitorsClient *network.ConnectionMonitorsClient DDOSProtectionPlansClient *network.DdosProtectionPlansClient ExpressRouteAuthsClient *network.ExpressRouteCircuitAuthorizationsClient @@ -45,6 +46,9 @@ func BuildClient(o *common.ClientOptions) *Client { AzureFirewallsClient := network.NewAzureFirewallsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&AzureFirewallsClient.Client, o.ResourceManagerAuthorizer) + BastionHostsClient := network.NewBastionHostsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&BastionHostsClient.Client, o.ResourceManagerAuthorizer) + ConnectionMonitorsClient := network.NewConnectionMonitorsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ConnectionMonitorsClient.Client, o.ResourceManagerAuthorizer) @@ -121,6 +125,7 @@ func BuildClient(o *common.ClientOptions) *Client { ApplicationGatewaysClient: &ApplicationGatewaysClient, ApplicationSecurityGroupsClient: &ApplicationSecurityGroupsClient, AzureFirewallsClient: &AzureFirewallsClient, + BastionHostsClient: &BastionHostsClient, ConnectionMonitorsClient: &ConnectionMonitorsClient, DDOSProtectionPlansClient: &DDOSProtectionPlansClient, ExpressRouteAuthsClient: &ExpressRouteAuthsClient, diff --git a/azurerm/provider.go b/azurerm/provider.go index b4274cb985af..15f420305d21 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -148,202 +148,203 @@ func Provider() terraform.ResourceProvider { } resources := map[string]*schema.Resource{ - "azurerm_analysis_services_server": resourceArmAnalysisServicesServer(), - "azurerm_api_management": resourceArmApiManagementService(), - "azurerm_api_management_api": resourceArmApiManagementApi(), - "azurerm_api_management_api_operation": resourceArmApiManagementApiOperation(), - "azurerm_api_management_api_operation_policy": resourceArmApiManagementApiOperationPolicy(), - "azurerm_api_management_api_policy": resourceArmApiManagementApiPolicy(), - "azurerm_api_management_api_schema": resourceArmApiManagementApiSchema(), - "azurerm_api_management_api_version_set": resourceArmApiManagementApiVersionSet(), - "azurerm_api_management_authorization_server": resourceArmApiManagementAuthorizationServer(), - "azurerm_api_management_backend": resourceArmApiManagementBackend(), - "azurerm_api_management_certificate": resourceArmApiManagementCertificate(), - "azurerm_api_management_group": resourceArmApiManagementGroup(), - "azurerm_api_management_group_user": resourceArmApiManagementGroupUser(), - "azurerm_api_management_logger": resourceArmApiManagementLogger(), - "azurerm_api_management_openid_connect_provider": resourceArmApiManagementOpenIDConnectProvider(), - "azurerm_api_management_product": resourceArmApiManagementProduct(), - "azurerm_api_management_product_api": resourceArmApiManagementProductApi(), - "azurerm_api_management_product_group": resourceArmApiManagementProductGroup(), - "azurerm_api_management_product_policy": resourceArmApiManagementProductPolicy(), - "azurerm_api_management_property": resourceArmApiManagementProperty(), - "azurerm_api_management_subscription": resourceArmApiManagementSubscription(), - "azurerm_api_management_user": resourceArmApiManagementUser(), - "azurerm_app_service_active_slot": resourceArmAppServiceActiveSlot(), - "azurerm_app_service_certificate": resourceArmAppServiceCertificate(), - "azurerm_app_service_custom_hostname_binding": resourceArmAppServiceCustomHostnameBinding(), - "azurerm_app_service_plan": resourceArmAppServicePlan(), - "azurerm_app_service_slot": resourceArmAppServiceSlot(), - "azurerm_app_service_source_control_token": resourceArmAppServiceSourceControlToken(), - "azurerm_app_service": resourceArmAppService(), - "azurerm_application_gateway": resourceArmApplicationGateway(), - "azurerm_application_insights_api_key": resourceArmApplicationInsightsAPIKey(), - "azurerm_application_insights": resourceArmApplicationInsights(), - "azurerm_application_insights_analytics_item": resourceArmApplicationInsightsAnalyticsItem(), - "azurerm_application_insights_web_test": resourceArmApplicationInsightsWebTests(), - "azurerm_application_security_group": resourceArmApplicationSecurityGroup(), - "azurerm_automation_account": resourceArmAutomationAccount(), - "azurerm_automation_credential": resourceArmAutomationCredential(), - "azurerm_automation_dsc_configuration": resourceArmAutomationDscConfiguration(), - "azurerm_automation_dsc_nodeconfiguration": resourceArmAutomationDscNodeConfiguration(), - "azurerm_automation_module": resourceArmAutomationModule(), - "azurerm_automation_runbook": resourceArmAutomationRunbook(), - "azurerm_automation_schedule": resourceArmAutomationSchedule(), - "azurerm_automation_variable_bool": resourceArmAutomationVariableBool(), - "azurerm_automation_variable_datetime": resourceArmAutomationVariableDateTime(), - "azurerm_automation_variable_int": resourceArmAutomationVariableInt(), - "azurerm_automation_variable_string": resourceArmAutomationVariableString(), - "azurerm_autoscale_setting": resourceArmAutoScaleSetting(), - "azurerm_availability_set": resourceArmAvailabilitySet(), - "azurerm_azuread_application": resourceArmActiveDirectoryApplication(), - "azurerm_azuread_service_principal_password": resourceArmActiveDirectoryServicePrincipalPassword(), - "azurerm_azuread_service_principal": resourceArmActiveDirectoryServicePrincipal(), - "azurerm_batch_account": resourceArmBatchAccount(), - "azurerm_batch_application": resourceArmBatchApplication(), - "azurerm_batch_certificate": resourceArmBatchCertificate(), - "azurerm_bot_channel_email": resourceArmBotChannelEmail(), - "azurerm_bot_channel_slack": resourceArmBotChannelSlack(), - "azurerm_bot_channels_registration": resourceArmBotChannelsRegistration(), - "azurerm_bot_connection": resourceArmBotConnection(), - "azurerm_bot_web_app": resourceArmBotWebApp(), - "azurerm_batch_pool": resourceArmBatchPool(), - "azurerm_cdn_endpoint": resourceArmCdnEndpoint(), - "azurerm_cdn_profile": resourceArmCdnProfile(), - "azurerm_cognitive_account": resourceArmCognitiveAccount(), - "azurerm_connection_monitor": resourceArmConnectionMonitor(), - "azurerm_container_group": resourceArmContainerGroup(), - "azurerm_container_registry_webhook": resourceArmContainerRegistryWebhook(), - "azurerm_container_registry": resourceArmContainerRegistry(), - "azurerm_container_service": resourceArmContainerService(), - "azurerm_cosmosdb_account": resourceArmCosmosDbAccount(), - "azurerm_cosmosdb_cassandra_keyspace": resourceArmCosmosDbCassandraKeyspace(), - "azurerm_cosmosdb_mongo_collection": resourceArmCosmosDbMongoCollection(), - "azurerm_cosmosdb_mongo_database": resourceArmCosmosDbMongoDatabase(), - "azurerm_cosmosdb_sql_container": resourceArmCosmosDbSQLContainer(), - "azurerm_cosmosdb_sql_database": resourceArmCosmosDbSQLDatabase(), - "azurerm_cosmosdb_table": resourceArmCosmosDbTable(), - "azurerm_dashboard": resourceArmDashboard(), - "azurerm_data_factory": resourceArmDataFactory(), - "azurerm_data_factory_dataset_mysql": resourceArmDataFactoryDatasetMySQL(), - "azurerm_data_factory_dataset_postgresql": resourceArmDataFactoryDatasetPostgreSQL(), - "azurerm_data_factory_dataset_sql_server_table": resourceArmDataFactoryDatasetSQLServerTable(), - "azurerm_data_factory_linked_service_data_lake_storage_gen2": resourceArmDataFactoryLinkedServiceDataLakeStorageGen2(), - "azurerm_data_factory_linked_service_mysql": resourceArmDataFactoryLinkedServiceMySQL(), - "azurerm_data_factory_linked_service_postgresql": resourceArmDataFactoryLinkedServicePostgreSQL(), - "azurerm_data_factory_linked_service_sql_server": resourceArmDataFactoryLinkedServiceSQLServer(), - "azurerm_data_factory_pipeline": resourceArmDataFactoryPipeline(), - "azurerm_data_lake_analytics_account": resourceArmDataLakeAnalyticsAccount(), - "azurerm_data_lake_analytics_firewall_rule": resourceArmDataLakeAnalyticsFirewallRule(), - "azurerm_data_lake_store_file": resourceArmDataLakeStoreFile(), - "azurerm_data_lake_store_firewall_rule": resourceArmDataLakeStoreFirewallRule(), - "azurerm_data_lake_store": resourceArmDataLakeStore(), - "azurerm_databricks_workspace": resourceArmDatabricksWorkspace(), - "azurerm_ddos_protection_plan": resourceArmDDoSProtectionPlan(), - "azurerm_dev_test_lab": resourceArmDevTestLab(), - "azurerm_dev_test_schedule": resourceArmDevTestLabSchedules(), - "azurerm_dev_test_linux_virtual_machine": resourceArmDevTestLinuxVirtualMachine(), - "azurerm_dev_test_policy": resourceArmDevTestPolicy(), - "azurerm_dev_test_virtual_network": resourceArmDevTestVirtualNetwork(), - "azurerm_dev_test_windows_virtual_machine": resourceArmDevTestWindowsVirtualMachine(), - "azurerm_devspace_controller": resourceArmDevSpaceController(), - "azurerm_dns_a_record": resourceArmDnsARecord(), - "azurerm_dns_aaaa_record": resourceArmDnsAAAARecord(), - "azurerm_dns_caa_record": resourceArmDnsCaaRecord(), - "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_domain": resourceArmEventGridDomain(), - "azurerm_eventgrid_event_subscription": resourceArmEventGridEventSubscription(), - "azurerm_eventgrid_topic": resourceArmEventGridTopic(), - "azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(), - "azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(), - "azurerm_eventhub_namespace_authorization_rule": resourceArmEventHubNamespaceAuthorizationRule(), - "azurerm_eventhub_namespace_disaster_recovery_config": resourceArmEventHubNamespaceDisasterRecoveryConfig(), - "azurerm_eventhub_namespace": resourceArmEventHubNamespace(), - "azurerm_eventhub": resourceArmEventHub(), - "azurerm_express_route_circuit_authorization": resourceArmExpressRouteCircuitAuthorization(), - "azurerm_express_route_circuit_peering": resourceArmExpressRouteCircuitPeering(), - "azurerm_express_route_circuit": resourceArmExpressRouteCircuit(), - "azurerm_firewall_application_rule_collection": resourceArmFirewallApplicationRuleCollection(), - "azurerm_firewall_nat_rule_collection": resourceArmFirewallNatRuleCollection(), - "azurerm_firewall_network_rule_collection": resourceArmFirewallNetworkRuleCollection(), - "azurerm_firewall": resourceArmFirewall(), - "azurerm_frontdoor": resourceArmFrontDoor(), - "azurerm_frontdoor_firewall_policy": resourceArmFrontDoorFirewallPolicy(), - "azurerm_function_app": resourceArmFunctionApp(), - "azurerm_hdinsight_hadoop_cluster": resourceArmHDInsightHadoopCluster(), - "azurerm_hdinsight_hbase_cluster": resourceArmHDInsightHBaseCluster(), - "azurerm_hdinsight_interactive_query_cluster": resourceArmHDInsightInteractiveQueryCluster(), - "azurerm_hdinsight_kafka_cluster": resourceArmHDInsightKafkaCluster(), - "azurerm_hdinsight_ml_services_cluster": resourceArmHDInsightMLServicesCluster(), - "azurerm_hdinsight_rserver_cluster": resourceArmHDInsightRServerCluster(), - "azurerm_hdinsight_spark_cluster": resourceArmHDInsightSparkCluster(), - "azurerm_hdinsight_storm_cluster": resourceArmHDInsightStormCluster(), - "azurerm_image": resourceArmImage(), - "azurerm_iot_dps": resourceArmIotDPS(), - "azurerm_iot_dps_certificate": resourceArmIotDPSCertificate(), - "azurerm_iothub_consumer_group": resourceArmIotHubConsumerGroup(), - "azurerm_iothub": resourceArmIotHub(), - "azurerm_iothub_shared_access_policy": resourceArmIotHubSharedAccessPolicy(), - "azurerm_key_vault_access_policy": resourceArmKeyVaultAccessPolicy(), - "azurerm_key_vault_certificate": resourceArmKeyVaultCertificate(), - "azurerm_key_vault_key": resourceArmKeyVaultKey(), - "azurerm_key_vault_secret": resourceArmKeyVaultSecret(), - "azurerm_key_vault": resourceArmKeyVault(), - "azurerm_kubernetes_cluster": resourceArmKubernetesCluster(), - "azurerm_kusto_cluster": resourceArmKustoCluster(), - "azurerm_kusto_database": resourceArmKustoDatabase(), - "azurerm_lb_backend_address_pool": resourceArmLoadBalancerBackendAddressPool(), - "azurerm_lb_nat_pool": resourceArmLoadBalancerNatPool(), - "azurerm_lb_nat_rule": resourceArmLoadBalancerNatRule(), - "azurerm_lb_probe": resourceArmLoadBalancerProbe(), - "azurerm_lb_outbound_rule": resourceArmLoadBalancerOutboundRule(), - "azurerm_lb_rule": resourceArmLoadBalancerRule(), - "azurerm_lb": resourceArmLoadBalancer(), - "azurerm_local_network_gateway": resourceArmLocalNetworkGateway(), - "azurerm_log_analytics_solution": resourceArmLogAnalyticsSolution(), - "azurerm_log_analytics_linked_service": resourceArmLogAnalyticsLinkedService(), - "azurerm_log_analytics_workspace_linked_service": resourceArmLogAnalyticsWorkspaceLinkedService(), - "azurerm_log_analytics_workspace": resourceArmLogAnalyticsWorkspace(), - "azurerm_logic_app_action_custom": resourceArmLogicAppActionCustom(), - "azurerm_logic_app_action_http": resourceArmLogicAppActionHTTP(), - "azurerm_logic_app_trigger_custom": resourceArmLogicAppTriggerCustom(), - "azurerm_logic_app_trigger_http_request": resourceArmLogicAppTriggerHttpRequest(), - "azurerm_logic_app_trigger_recurrence": resourceArmLogicAppTriggerRecurrence(), - "azurerm_logic_app_workflow": resourceArmLogicAppWorkflow(), - "azurerm_managed_disk": resourceArmManagedDisk(), - "azurerm_management_group": resourceArmManagementGroup(), - "azurerm_management_lock": resourceArmManagementLock(), - "azurerm_maps_account": resourceArmMapsAccount(), - "azurerm_mariadb_configuration": resourceArmMariaDbConfiguration(), - "azurerm_mariadb_database": resourceArmMariaDbDatabase(), - "azurerm_mariadb_firewall_rule": resourceArmMariaDBFirewallRule(), - "azurerm_mariadb_server": resourceArmMariaDbServer(), - "azurerm_mariadb_virtual_network_rule": resourceArmMariaDbVirtualNetworkRule(), - "azurerm_marketplace_agreement": resourceArmMarketplaceAgreement(), - "azurerm_media_services_account": resourceArmMediaServicesAccount(), - "azurerm_metric_alertrule": resourceArmMetricAlertRule(), - "azurerm_monitor_autoscale_setting": resourceArmMonitorAutoScaleSetting(), - "azurerm_monitor_action_group": resourceArmMonitorActionGroup(), - "azurerm_monitor_activity_log_alert": resourceArmMonitorActivityLogAlert(), - "azurerm_monitor_diagnostic_setting": resourceArmMonitorDiagnosticSetting(), - "azurerm_monitor_log_profile": resourceArmMonitorLogProfile(), - "azurerm_monitor_metric_alert": resourceArmMonitorMetricAlert(), - "azurerm_monitor_metric_alertrule": resourceArmMonitorMetricAlertRule(), - "azurerm_mssql_elasticpool": resourceArmMsSqlElasticPool(), - "azurerm_mysql_configuration": resourceArmMySQLConfiguration(), - "azurerm_mysql_database": resourceArmMySqlDatabase(), - "azurerm_mysql_firewall_rule": resourceArmMySqlFirewallRule(), - "azurerm_mysql_server": resourceArmMySqlServer(), - "azurerm_mysql_virtual_network_rule": resourceArmMySqlVirtualNetworkRule(), - "azurerm_network_connection_monitor": resourceArmNetworkConnectionMonitor(), - "azurerm_network_ddos_protection_plan": resourceArmNetworkDDoSProtectionPlan(), - "azurerm_network_interface": resourceArmNetworkInterface(), + "azurerm_analysis_services_server": resourceArmAnalysisServicesServer(), + "azurerm_api_management": resourceArmApiManagementService(), + "azurerm_api_management_api": resourceArmApiManagementApi(), + "azurerm_api_management_api_operation": resourceArmApiManagementApiOperation(), + "azurerm_api_management_api_operation_policy": resourceArmApiManagementApiOperationPolicy(), + "azurerm_api_management_api_policy": resourceArmApiManagementApiPolicy(), + "azurerm_api_management_api_schema": resourceArmApiManagementApiSchema(), + "azurerm_api_management_api_version_set": resourceArmApiManagementApiVersionSet(), + "azurerm_api_management_authorization_server": resourceArmApiManagementAuthorizationServer(), + "azurerm_api_management_backend": resourceArmApiManagementBackend(), + "azurerm_api_management_certificate": resourceArmApiManagementCertificate(), + "azurerm_api_management_group": resourceArmApiManagementGroup(), + "azurerm_api_management_group_user": resourceArmApiManagementGroupUser(), + "azurerm_api_management_logger": resourceArmApiManagementLogger(), + "azurerm_api_management_openid_connect_provider": resourceArmApiManagementOpenIDConnectProvider(), + "azurerm_api_management_product": resourceArmApiManagementProduct(), + "azurerm_api_management_product_api": resourceArmApiManagementProductApi(), + "azurerm_api_management_product_group": resourceArmApiManagementProductGroup(), + "azurerm_api_management_product_policy": resourceArmApiManagementProductPolicy(), + "azurerm_api_management_property": resourceArmApiManagementProperty(), + "azurerm_api_management_subscription": resourceArmApiManagementSubscription(), + "azurerm_api_management_user": resourceArmApiManagementUser(), + "azurerm_app_service_active_slot": resourceArmAppServiceActiveSlot(), + "azurerm_app_service_certificate": resourceArmAppServiceCertificate(), + "azurerm_app_service_custom_hostname_binding": resourceArmAppServiceCustomHostnameBinding(), + "azurerm_app_service_plan": resourceArmAppServicePlan(), + "azurerm_app_service_slot": resourceArmAppServiceSlot(), + "azurerm_app_service_source_control_token": resourceArmAppServiceSourceControlToken(), + "azurerm_app_service": resourceArmAppService(), + "azurerm_application_gateway": resourceArmApplicationGateway(), + "azurerm_application_insights_api_key": resourceArmApplicationInsightsAPIKey(), + "azurerm_application_insights": resourceArmApplicationInsights(), + "azurerm_application_insights_analytics_item": resourceArmApplicationInsightsAnalyticsItem(), + "azurerm_application_insights_web_test": resourceArmApplicationInsightsWebTests(), + "azurerm_application_security_group": resourceArmApplicationSecurityGroup(), + "azurerm_automation_account": resourceArmAutomationAccount(), + "azurerm_automation_credential": resourceArmAutomationCredential(), + "azurerm_automation_dsc_configuration": resourceArmAutomationDscConfiguration(), + "azurerm_automation_dsc_nodeconfiguration": resourceArmAutomationDscNodeConfiguration(), + "azurerm_automation_module": resourceArmAutomationModule(), + "azurerm_automation_runbook": resourceArmAutomationRunbook(), + "azurerm_automation_schedule": resourceArmAutomationSchedule(), + "azurerm_automation_variable_bool": resourceArmAutomationVariableBool(), + "azurerm_automation_variable_datetime": resourceArmAutomationVariableDateTime(), + "azurerm_automation_variable_int": resourceArmAutomationVariableInt(), + "azurerm_automation_variable_string": resourceArmAutomationVariableString(), + "azurerm_autoscale_setting": resourceArmAutoScaleSetting(), + "azurerm_availability_set": resourceArmAvailabilitySet(), + "azurerm_azuread_application": resourceArmActiveDirectoryApplication(), + "azurerm_azuread_service_principal_password": resourceArmActiveDirectoryServicePrincipalPassword(), + "azurerm_azuread_service_principal": resourceArmActiveDirectoryServicePrincipal(), + "azurerm_bastion_host": resourceArmBastionHost(), + "azurerm_batch_account": resourceArmBatchAccount(), + "azurerm_batch_application": resourceArmBatchApplication(), + "azurerm_batch_certificate": resourceArmBatchCertificate(), + "azurerm_bot_channel_email": resourceArmBotChannelEmail(), + "azurerm_bot_channel_slack": resourceArmBotChannelSlack(), + "azurerm_bot_channels_registration": resourceArmBotChannelsRegistration(), + "azurerm_bot_connection": resourceArmBotConnection(), + "azurerm_bot_web_app": resourceArmBotWebApp(), + "azurerm_batch_pool": resourceArmBatchPool(), + "azurerm_cdn_endpoint": resourceArmCdnEndpoint(), + "azurerm_cdn_profile": resourceArmCdnProfile(), + "azurerm_cognitive_account": resourceArmCognitiveAccount(), + "azurerm_connection_monitor": resourceArmConnectionMonitor(), + "azurerm_container_group": resourceArmContainerGroup(), + "azurerm_container_registry_webhook": resourceArmContainerRegistryWebhook(), + "azurerm_container_registry": resourceArmContainerRegistry(), + "azurerm_container_service": resourceArmContainerService(), + "azurerm_cosmosdb_account": resourceArmCosmosDbAccount(), + "azurerm_cosmosdb_cassandra_keyspace": resourceArmCosmosDbCassandraKeyspace(), + "azurerm_cosmosdb_mongo_collection": resourceArmCosmosDbMongoCollection(), + "azurerm_cosmosdb_mongo_database": resourceArmCosmosDbMongoDatabase(), + "azurerm_cosmosdb_sql_container": resourceArmCosmosDbSQLContainer(), + "azurerm_cosmosdb_sql_database": resourceArmCosmosDbSQLDatabase(), + "azurerm_cosmosdb_table": resourceArmCosmosDbTable(), + "azurerm_dashboard": resourceArmDashboard(), + "azurerm_data_factory": resourceArmDataFactory(), + "azurerm_data_factory_dataset_mysql": resourceArmDataFactoryDatasetMySQL(), + "azurerm_data_factory_dataset_postgresql": resourceArmDataFactoryDatasetPostgreSQL(), + "azurerm_data_factory_dataset_sql_server_table": resourceArmDataFactoryDatasetSQLServerTable(), + "azurerm_data_factory_linked_service_data_lake_storage_gen2": resourceArmDataFactoryLinkedServiceDataLakeStorageGen2(), + "azurerm_data_factory_linked_service_mysql": resourceArmDataFactoryLinkedServiceMySQL(), + "azurerm_data_factory_linked_service_postgresql": resourceArmDataFactoryLinkedServicePostgreSQL(), + "azurerm_data_factory_linked_service_sql_server": resourceArmDataFactoryLinkedServiceSQLServer(), + "azurerm_data_factory_pipeline": resourceArmDataFactoryPipeline(), + "azurerm_data_lake_analytics_account": resourceArmDataLakeAnalyticsAccount(), + "azurerm_data_lake_analytics_firewall_rule": resourceArmDataLakeAnalyticsFirewallRule(), + "azurerm_data_lake_store_file": resourceArmDataLakeStoreFile(), + "azurerm_data_lake_store_firewall_rule": resourceArmDataLakeStoreFirewallRule(), + "azurerm_data_lake_store": resourceArmDataLakeStore(), + "azurerm_databricks_workspace": resourceArmDatabricksWorkspace(), + "azurerm_ddos_protection_plan": resourceArmDDoSProtectionPlan(), + "azurerm_dev_test_lab": resourceArmDevTestLab(), + "azurerm_dev_test_schedule": resourceArmDevTestLabSchedules(), + "azurerm_dev_test_linux_virtual_machine": resourceArmDevTestLinuxVirtualMachine(), + "azurerm_dev_test_policy": resourceArmDevTestPolicy(), + "azurerm_dev_test_virtual_network": resourceArmDevTestVirtualNetwork(), + "azurerm_dev_test_windows_virtual_machine": resourceArmDevTestWindowsVirtualMachine(), + "azurerm_devspace_controller": resourceArmDevSpaceController(), + "azurerm_dns_a_record": resourceArmDnsARecord(), + "azurerm_dns_aaaa_record": resourceArmDnsAAAARecord(), + "azurerm_dns_caa_record": resourceArmDnsCaaRecord(), + "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_domain": resourceArmEventGridDomain(), + "azurerm_eventgrid_event_subscription": resourceArmEventGridEventSubscription(), + "azurerm_eventgrid_topic": resourceArmEventGridTopic(), + "azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(), + "azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(), + "azurerm_eventhub_namespace_authorization_rule": resourceArmEventHubNamespaceAuthorizationRule(), + "azurerm_eventhub_namespace_disaster_recovery_config": resourceArmEventHubNamespaceDisasterRecoveryConfig(), + "azurerm_eventhub_namespace": resourceArmEventHubNamespace(), + "azurerm_eventhub": resourceArmEventHub(), + "azurerm_express_route_circuit_authorization": resourceArmExpressRouteCircuitAuthorization(), + "azurerm_express_route_circuit_peering": resourceArmExpressRouteCircuitPeering(), + "azurerm_express_route_circuit": resourceArmExpressRouteCircuit(), + "azurerm_firewall_application_rule_collection": resourceArmFirewallApplicationRuleCollection(), + "azurerm_firewall_nat_rule_collection": resourceArmFirewallNatRuleCollection(), + "azurerm_firewall_network_rule_collection": resourceArmFirewallNetworkRuleCollection(), + "azurerm_firewall": resourceArmFirewall(), + "azurerm_frontdoor": resourceArmFrontDoor(), + "azurerm_frontdoor_firewall_policy": resourceArmFrontDoorFirewallPolicy(), + "azurerm_function_app": resourceArmFunctionApp(), + "azurerm_hdinsight_hadoop_cluster": resourceArmHDInsightHadoopCluster(), + "azurerm_hdinsight_hbase_cluster": resourceArmHDInsightHBaseCluster(), + "azurerm_hdinsight_interactive_query_cluster": resourceArmHDInsightInteractiveQueryCluster(), + "azurerm_hdinsight_kafka_cluster": resourceArmHDInsightKafkaCluster(), + "azurerm_hdinsight_ml_services_cluster": resourceArmHDInsightMLServicesCluster(), + "azurerm_hdinsight_rserver_cluster": resourceArmHDInsightRServerCluster(), + "azurerm_hdinsight_spark_cluster": resourceArmHDInsightSparkCluster(), + "azurerm_hdinsight_storm_cluster": resourceArmHDInsightStormCluster(), + "azurerm_image": resourceArmImage(), + "azurerm_iot_dps": resourceArmIotDPS(), + "azurerm_iot_dps_certificate": resourceArmIotDPSCertificate(), + "azurerm_iothub_consumer_group": resourceArmIotHubConsumerGroup(), + "azurerm_iothub": resourceArmIotHub(), + "azurerm_iothub_shared_access_policy": resourceArmIotHubSharedAccessPolicy(), + "azurerm_key_vault_access_policy": resourceArmKeyVaultAccessPolicy(), + "azurerm_key_vault_certificate": resourceArmKeyVaultCertificate(), + "azurerm_key_vault_key": resourceArmKeyVaultKey(), + "azurerm_key_vault_secret": resourceArmKeyVaultSecret(), + "azurerm_key_vault": resourceArmKeyVault(), + "azurerm_kubernetes_cluster": resourceArmKubernetesCluster(), + "azurerm_kusto_cluster": resourceArmKustoCluster(), + "azurerm_kusto_database": resourceArmKustoDatabase(), + "azurerm_lb_backend_address_pool": resourceArmLoadBalancerBackendAddressPool(), + "azurerm_lb_nat_pool": resourceArmLoadBalancerNatPool(), + "azurerm_lb_nat_rule": resourceArmLoadBalancerNatRule(), + "azurerm_lb_probe": resourceArmLoadBalancerProbe(), + "azurerm_lb_outbound_rule": resourceArmLoadBalancerOutboundRule(), + "azurerm_lb_rule": resourceArmLoadBalancerRule(), + "azurerm_lb": resourceArmLoadBalancer(), + "azurerm_local_network_gateway": resourceArmLocalNetworkGateway(), + "azurerm_log_analytics_solution": resourceArmLogAnalyticsSolution(), + "azurerm_log_analytics_linked_service": resourceArmLogAnalyticsLinkedService(), + "azurerm_log_analytics_workspace_linked_service": resourceArmLogAnalyticsWorkspaceLinkedService(), + "azurerm_log_analytics_workspace": resourceArmLogAnalyticsWorkspace(), + "azurerm_logic_app_action_custom": resourceArmLogicAppActionCustom(), + "azurerm_logic_app_action_http": resourceArmLogicAppActionHTTP(), + "azurerm_logic_app_trigger_custom": resourceArmLogicAppTriggerCustom(), + "azurerm_logic_app_trigger_http_request": resourceArmLogicAppTriggerHttpRequest(), + "azurerm_logic_app_trigger_recurrence": resourceArmLogicAppTriggerRecurrence(), + "azurerm_logic_app_workflow": resourceArmLogicAppWorkflow(), + "azurerm_managed_disk": resourceArmManagedDisk(), + "azurerm_management_group": resourceArmManagementGroup(), + "azurerm_management_lock": resourceArmManagementLock(), + "azurerm_maps_account": resourceArmMapsAccount(), + "azurerm_mariadb_configuration": resourceArmMariaDbConfiguration(), + "azurerm_mariadb_database": resourceArmMariaDbDatabase(), + "azurerm_mariadb_firewall_rule": resourceArmMariaDBFirewallRule(), + "azurerm_mariadb_server": resourceArmMariaDbServer(), + "azurerm_mariadb_virtual_network_rule": resourceArmMariaDbVirtualNetworkRule(), + "azurerm_marketplace_agreement": resourceArmMarketplaceAgreement(), + "azurerm_media_services_account": resourceArmMediaServicesAccount(), + "azurerm_metric_alertrule": resourceArmMetricAlertRule(), + "azurerm_monitor_autoscale_setting": resourceArmMonitorAutoScaleSetting(), + "azurerm_monitor_action_group": resourceArmMonitorActionGroup(), + "azurerm_monitor_activity_log_alert": resourceArmMonitorActivityLogAlert(), + "azurerm_monitor_diagnostic_setting": resourceArmMonitorDiagnosticSetting(), + "azurerm_monitor_log_profile": resourceArmMonitorLogProfile(), + "azurerm_monitor_metric_alert": resourceArmMonitorMetricAlert(), + "azurerm_monitor_metric_alertrule": resourceArmMonitorMetricAlertRule(), + "azurerm_mssql_elasticpool": resourceArmMsSqlElasticPool(), + "azurerm_mysql_configuration": resourceArmMySQLConfiguration(), + "azurerm_mysql_database": resourceArmMySqlDatabase(), + "azurerm_mysql_firewall_rule": resourceArmMySqlFirewallRule(), + "azurerm_mysql_server": resourceArmMySqlServer(), + "azurerm_mysql_virtual_network_rule": resourceArmMySqlVirtualNetworkRule(), + "azurerm_network_connection_monitor": resourceArmNetworkConnectionMonitor(), + "azurerm_network_ddos_protection_plan": resourceArmNetworkDDoSProtectionPlan(), + "azurerm_network_interface": resourceArmNetworkInterface(), "azurerm_network_interface_application_gateway_backend_address_pool_association": resourceArmNetworkInterfaceApplicationGatewayBackendAddressPoolAssociation(), "azurerm_network_interface_application_security_group_association": resourceArmNetworkInterfaceApplicationSecurityGroupAssociation(), "azurerm_network_interface_backend_address_pool_association": resourceArmNetworkInterfaceBackendAddressPoolAssociation(), diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go new file mode 100644 index 000000000000..a59e11095a16 --- /dev/null +++ b/azurerm/resource_arm_bastion_host.go @@ -0,0 +1,268 @@ +package azurerm + +import ( + "fmt" + "log" + "regexp" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags" + + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" + "github.com/hashicorp/terraform/helper/schema" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmBastionHost() *schema.Resource { + return &schema.Resource{ + Create: resourceArmBastionHostCreateUpdate, + Read: resourceArmBastionHostRead, + Update: resourceArmBastionHostCreateUpdate, + Delete: resourceArmBastionHostDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validateAzureRMBastionHostName, + }, + + "location": azure.SchemaLocation(), + + "resource_group_name": azure.SchemaResourceGroupName(), + + "dns_name": { + Type: schema.TypeString, + Optional: true, + }, + + "ip_configuration": { + Type: schema.TypeList, + ForceNew: true, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "subnet_id": { + Type: schema.TypeString, + Required: true, + ValidateFunc: azure.ValidateResourceID, + }, + "public_ip_address_id": { + Type: schema.TypeString, + Required: true, + ValidateFunc: azure.ValidateResourceID, + }, + }, + }, + }, + + "tags": tags.Schema(), + }, + } +} + +func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).network.BastionHostsClient + ctx := meta.(*ArmClient).StopContext + + log.Println("[INFO] preparing arguments for Azure Bastion Host creation.") + + resourceGroup := d.Get("resource_group_name").(string) + name := d.Get("name").(string) + location := azure.NormalizeLocation(d.Get("location").(string)) + tags := d.Get("tags").(map[string]interface{}) + + if requireResourcesToBeImported && d.IsNewResource() { + existing, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("Error checking for presence of existing Bastion Host %q (Resource Group %q): %s", name, resourceGroup, err) + } + } + + if existing.ID != nil && *existing.ID != "" { + return tf.ImportAsExistsError("azurerm_bastion_host", *existing.ID) + } + } + + ipconfig := expandArmBastionHostIPConfiguration(d.Get("ip_configuration").([]interface{})) + parameters := network.BastionHost{ + Location: &location, + BastionHostPropertiesFormat: &network.BastionHostPropertiesFormat{ + IPConfigurations: &ipconfig, + }, + Tags: expandTags(tags), + } + + dnsName, dnsOk := d.GetOkExists("dns_name") + if dnsOk { + parameters.BastionHostPropertiesFormat.DNSName = utils.String(dnsName.(string)) + } + + future, err := client.CreateOrUpdate(ctx, resourceGroup, name, parameters) + if err != nil { + return fmt.Errorf("Error creating/updating Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("Error waiting for creation/update of Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + read, err := client.Get(ctx, resourceGroup, name) + if err != nil { + return fmt.Errorf("Error retrieving Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + d.SetId(*read.ID) + + return resourceArmBastionHostRead(d, meta) +} + +func resourceArmBastionHostRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).network.BastionHostsClient + ctx := meta.(*ArmClient).StopContext + + id, err := azure.ParseAzureResourceID(d.Id()) + if err != nil { + return err + } + + name := id.Path["bastionHosts"] + resourceGroup := id.ResourceGroup + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + log.Printf("[DEBUG] Bastion Host %q was not found in Resource Group %q - removing from state!", name, resourceGroup) + return nil + } + return fmt.Errorf("Error reading the state of Bastion Host %q: %+v", name, err) + } + + d.Set("name", resp.Name) + d.Set("resource_group_name", resourceGroup) + + if location := resp.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } + + if props := resp.BastionHostPropertiesFormat; props != nil { + if ipConfigs := props.IPConfigurations; ipConfigs != nil { + d.Set("dns_name", props.DNSName) + if err := d.Set("ip_configuration", flattenArmBastionHostIPConfiguration(ipConfigs)); err != nil { + return fmt.Errorf("Error flattening `ip_configuration`: %+v", err) + } + } + } + + return tags.FlattenAndSet(d, resp.Tags) +} + +func resourceArmBastionHostDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).network.BastionHostsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + + name := id.Path["bastionHosts"] + resourceGroup := id.ResourceGroup + + future, err := client.Delete(ctx, resourceGroup, name) + if err != nil { + return fmt.Errorf("Error deleting Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + if !response.WasNotFound(future.Response()) { + return fmt.Errorf("Error waiting for deletion of Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) + } + } + + return nil +} + +func validateAzureRMBastionHostName(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf("lowercase letters, highercase letters numbers only are allowed in %q: %q", k, value)) + } + + if 1 > len(value) { + errors = append(errors, fmt.Errorf("%q cannot be less than 1 characters: %q", k, value)) + } + + if len(value) > 64 { + errors = append(errors, fmt.Errorf("%q cannot be longer than 64 characters: %q %d", k, value, len(value))) + } + + return warnings, errors +} + +func expandArmBastionHostIPConfiguration(input []interface{}) (ipConfigs []network.BastionHostIPConfiguration) { + if len(input) == 0 { + return nil + } + + property := input[0].(map[string]interface{}) + ipConfName := property["name"].(string) + subID := property["subnet_id"].(string) + pipID := property["public_ip_address_id"].(string) + + return []network.BastionHostIPConfiguration{ + { + Name: &ipConfName, + BastionHostIPConfigurationPropertiesFormat: &network.BastionHostIPConfigurationPropertiesFormat{ + Subnet: &network.SubResource{ + ID: &subID, + }, + PublicIPAddress: &network.SubResource{ + ID: &pipID, + }, + }, + }, + } +} + +func flattenArmBastionHostIPConfiguration(ipConfigs *[]network.BastionHostIPConfiguration) []interface{} { + result := make([]interface{}, 0) + if ipConfigs == nil { + return result + } + + for _, config := range *ipConfigs { + ipConfig := make(map[string]interface{}) + + if config.Name != nil { + ipConfig["name"] = *config.Name + } + + if props := config.BastionHostIPConfigurationPropertiesFormat; props != nil { + if subnet := props.Subnet; subnet != nil { + ipConfig["subnet_id"] = *subnet.ID + } + + if pip := props.PublicIPAddress; pip != nil { + ipConfig["public_ip_address_id"] = *pip.ID + } + } + + result = append(result, ipConfig) + } + return result +} diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go new file mode 100644 index 000000000000..95277e34f9a1 --- /dev/null +++ b/azurerm/resource_arm_bastion_host_test.go @@ -0,0 +1,244 @@ +package azurerm + +import ( + "fmt" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" + "testing" +) + +func TestAccAzureRMBastionHost_basic(t *testing.T) { + resourceName := "azurerm_bastion_host.test" + ri := tf.AccRandTimeInt() + rs := acctest.RandString(4) + + config := testAccAzureRMBastionHost_basic(ri, rs, testLocation()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMBastionHostDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMBastionHostExists(resourceName), + ), + }, + }, + }) +} + +func TestAccAzureRMBastionHost_complete(t *testing.T) { + resourceName := "azurerm_bastion_host.test" + ri := tf.AccRandTimeInt() + rs := acctest.RandString(4) + + config := testAccAzureRMBastionHost_complete(ri, rs, testLocation()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMBastionHostDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMBastionHostExists(resourceName), + ), + }, + }, + }) +} + +func TestAccAzureRMBastionHost_requiresImport(t *testing.T) { + if !features.ShouldResourcesBeImported() { + t.Skip("Skipping since resources aren't required to be imported") + return + } + + resourceName := "azurerm_bastion_host.test" + ri := tf.AccRandTimeInt() + rs := acctest.RandString(4) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMBastionHostDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMBastionHost_basic(ri, rs, testLocation()), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMBastionHostExists(resourceName), + ), + }, + { + Config: testAccAzureRMBastionHost_requiresImport(ri, rs, testLocation()), + ExpectError: testRequiresImportError("azurerm_bastion_host"), + }, + }, + }) +} + +func testAccAzureRMBastionHost_basic(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctestVNet%s" + address_space = ["192.168.1.0/24"] + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_subnet" "test" { + name = "AzureBastionSubnet" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "192.168.1.224/27" +} + +resource "azurerm_public_ip" "test" { + name = "acctestBastionPIP%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + allocation_method = "Static" + sku = "Standard" +} + +resource "azurerm_bastion_host" "test" { + name = "acctestBastion%s" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + ip_configuration { + name = "configuration" + subnet_id = "${azurerm_subnet.test.id}" + public_ip_address_id = "${azurerm_public_ip.test.id}" + } +} +`, rInt, location, rString, rInt, rString) +} + +func testAccAzureRMBastionHost_complete(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctestVNet%s" + address_space = ["192.168.1.0/24"] + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" +} + +resource "azurerm_subnet" "test" { + name = "AzureBastionSubnet" + resource_group_name = "${azurerm_resource_group.test.name}" + virtual_network_name = "${azurerm_virtual_network.test.name}" + address_prefix = "192.168.1.224/27" +} + +resource "azurerm_public_ip" "test" { + name = "acctestBastionPIP%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + allocation_method = "Static" + sku = "Standard" +} + +resource "azurerm_bastion_host" "test" { + name = "acctestBastion%s" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + dns_name = "acctestBastion%s" + + ip_configuration { + name = "configuration" + subnet_id = "${azurerm_subnet.test.id}" + public_ip_address_id = "${azurerm_public_ip.test.id}" + } + + tags = { + environment = "production" + } +} +`, rInt, location, rString, rInt, rString, rString) +} + +func testAccAzureRMBastionHost_requiresImport(rInt int, rString string, location string) string { + template := testAccAzureRMBastionHost_basic(rInt, rString, location) + return fmt.Sprintf(` +%s +resource "azurerm_bastion_host" "import" { + name = "${azurerm_batch_account.test.name}" + resource_group_name = "${azurerm_batch_account.test.resource_group_name}" + location = "${azurerm_batch_account.test.location}" + ip_configuration { + name = "configuration" + subnet_id = "${azurerm_subnet.test.id}" + public_ip_address_id = "${azurerm_public_ip.test.id}" + } +} +`, template) +} + +func testCheckAzureRMBastionHostExists(resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + client := testAccProvider.Meta().(*ArmClient).network.BastionHostsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("Not found: %q", resourceName) + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Bad: Azure Bastion Host %q does not exist", rs.Primary.ID) + } + return fmt.Errorf("Bad: Get on Azure Bastion Host Client: %+v", err) + } + + return nil + } +} + +func testCheckAzureRMBastionHostDestroy(s *terraform.State) error { + client := testAccProvider.Meta().(*ArmClient).network.BastionHostsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_bastion_host" { + continue + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if !utils.ResponseWasNotFound(resp.Response) { + return err + } + } + + return nil + } + + return nil +} diff --git a/go.mod b/go.mod index 595ef9893701..96337d3427b9 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/terraform-providers/terraform-provider-azurerm require ( github.com/Azure/azure-sdk-for-go v33.2.0+incompatible github.com/Azure/go-autorest/autorest v0.9.0 + github.com/Azure/go-autorest/autorest/azure/auth v0.3.0 github.com/Azure/go-autorest/autorest/date v0.2.0 github.com/btubbs/datetime v0.1.0 github.com/davecgh/go-spew v1.1.1 diff --git a/website/docs/r/bastion_host.html.markdown b/website/docs/r/bastion_host.html.markdown new file mode 100644 index 000000000000..0dd3017cda20 --- /dev/null +++ b/website/docs/r/bastion_host.html.markdown @@ -0,0 +1,91 @@ +--- +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_bastion_host" +sidebar_current: "docs-azurerm-resource-bastion-host-x" +description: |- + Manages a Bastion Host Instance. + +--- + +# azurerm_bastion_host + +Manages a Bastion Host Instance. + +## Example Usage + +This example deploys an Azure Bastion Host Instance to a target virtual network. + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_virtual_network" "example" { + name = "examplevnet" + address_space = ["192.168.1.0/24"] + location = "${azurerm_resource_group.example.location}" + resource_group_name = "${azurerm_resource_group.example.name}" +} + +resource "azurerm_subnet" "example" { + name = "AzureBastionSubnet" + resource_group_name = "${azurerm_resource_group.example.name}" + virtual_network_name = "${azurerm_virtual_network.example.name}" + address_prefix = "192.168.1.224/27" +} + +resource "azurerm_public_ip" "example" { + name = "examplepip" + location = "${azurerm_resource_group.example.location}" + resource_group_name = "${azurerm_resource_group.example.name}" + allocation_method = "Static" + sku = "Standard" +} + +resource "azurerm_bastion_host" "example" { + name = "examplebastion" + location = "${azurerm_resource_group.example.location}" + resource_group_name = "${azurerm_resource_group.example.name}" + + ip_configuration { + name = "configuration" + subnet_id = "${azurerm_subnet.example.id}" + public_ip_address_id = "${azurerm_public_ip.example.id}" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name of the Bastion Host. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the resource group in which to create the Bastion Host. + +* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. + +* `dns_name` - (Optional) Specifies the DNS prefix for the Bastion Host. + +* `ip_configuration` - (Required) A `ip_configuration` block as defined below. + +* `tags` - (Optional) A mapping of tags to assign to the resource. + +--- + +A `ip_configuration` block supports the following: + +* `name` - (Required) The name of the IP configuration. + +* `subnet_id` - (Required) Reference to a subnet in which this Bastion Host has been created. + +* `public_ip_address_id` (Required) Reference to a Public IP Address to associate with this Bastion Host. + +## Import + +Bastion Hosts can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_bastion_host.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/bastionHosts/instance1 +``` From 8aeb4c7f97c03d03d427e5d2ebf98c3f988ff022 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Mon, 7 Oct 2019 15:29:32 +0100 Subject: [PATCH 15/19] working tests. Notes for Bastion Markdown --- azurerm/resource_arm_bastion_host.go | 11 ++++------- azurerm/resource_arm_bastion_host_test.go | 14 ++++++++------ website/docs/r/bastion_host.html.markdown | 11 +++++++++-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go index a59e11095a16..9db9b1fd5dec 100644 --- a/azurerm/resource_arm_bastion_host.go +++ b/azurerm/resource_arm_bastion_host.go @@ -40,7 +40,7 @@ func resourceArmBastionHost() *schema.Resource { "dns_name": { Type: schema.TypeString, - Optional: true, + Computed: true, }, "ip_configuration": { @@ -106,11 +106,6 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} Tags: expandTags(tags), } - dnsName, dnsOk := d.GetOkExists("dns_name") - if dnsOk { - parameters.BastionHostPropertiesFormat.DNSName = utils.String(dnsName.(string)) - } - future, err := client.CreateOrUpdate(ctx, resourceGroup, name, parameters) if err != nil { return fmt.Errorf("Error creating/updating Bastion Host %q (Resource Group %q): %+v", name, resourceGroup, err) @@ -160,8 +155,10 @@ func resourceArmBastionHostRead(d *schema.ResourceData, meta interface{}) error } if props := resp.BastionHostPropertiesFormat; props != nil { + d.Set("dns_name", props.DNSName) + if ipConfigs := props.IPConfigurations; ipConfigs != nil { - d.Set("dns_name", props.DNSName) + if err := d.Set("ip_configuration", flattenArmBastionHostIPConfiguration(ipConfigs)); err != nil { return fmt.Errorf("Error flattening `ip_configuration`: %+v", err) } diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go index 95277e34f9a1..3d4e7a2046f2 100644 --- a/azurerm/resource_arm_bastion_host_test.go +++ b/azurerm/resource_arm_bastion_host_test.go @@ -50,6 +50,8 @@ func TestAccAzureRMBastionHost_complete(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMBastionHostExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.environment", "production"), ), }, }, @@ -161,19 +163,18 @@ resource "azurerm_bastion_host" "test" { name = "acctestBastion%s" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" - dns_name = "acctestBastion%s" ip_configuration { name = "configuration" subnet_id = "${azurerm_subnet.test.id}" public_ip_address_id = "${azurerm_public_ip.test.id}" } - + tags = { environment = "production" } } -`, rInt, location, rString, rInt, rString, rString) +`, rInt, location, rString, rInt, rString) } func testAccAzureRMBastionHost_requiresImport(rInt int, rString string, location string) string { @@ -181,9 +182,10 @@ func testAccAzureRMBastionHost_requiresImport(rInt int, rString string, location return fmt.Sprintf(` %s resource "azurerm_bastion_host" "import" { - name = "${azurerm_batch_account.test.name}" - resource_group_name = "${azurerm_batch_account.test.resource_group_name}" - location = "${azurerm_batch_account.test.location}" + name = "${azurerm_bastion_host.test.name}" + resource_group_name = "${azurerm_bastion_host.test.resource_group_name}" + location = "${azurerm_bastion_host.test.location}" + ip_configuration { name = "configuration" subnet_id = "${azurerm_subnet.test.id}" diff --git a/website/docs/r/bastion_host.html.markdown b/website/docs/r/bastion_host.html.markdown index 0dd3017cda20..7b447af6d1c6 100644 --- a/website/docs/r/bastion_host.html.markdown +++ b/website/docs/r/bastion_host.html.markdown @@ -11,6 +11,8 @@ description: |- Manages a Bastion Host Instance. +~> **Note:** Bastion Host Instances are a preview feature in Azure, and therefore are only supported in a select number of regions. [Read more](https://docs.microsoft.com/en-us/azure/bastion/bastion-faq). + ## Example Usage This example deploys an Azure Bastion Host Instance to a target virtual network. @@ -66,8 +68,6 @@ The following arguments are supported: * `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -* `dns_name` - (Optional) Specifies the DNS prefix for the Bastion Host. - * `ip_configuration` - (Required) A `ip_configuration` block as defined below. * `tags` - (Optional) A mapping of tags to assign to the resource. @@ -82,6 +82,13 @@ A `ip_configuration` block supports the following: * `public_ip_address_id` (Required) Reference to a Public IP Address to associate with this Bastion Host. + +## Attributes Reference + +The following attributes are exported: + +* `dns_name` - The FQDN for the Azure Bastion Host. + ## Import Bastion Hosts can be imported using the `resource id`, e.g. From 8efb4ef84e26ffd94a81547a3815b0405646cc70 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Mon, 7 Oct 2019 16:33:11 +0100 Subject: [PATCH 16/19] update with pull from upstream --- azurerm/resource_arm_bastion_host.go | 34 +++++++++++++++++------ azurerm/resource_arm_bastion_host_test.go | 12 ++++---- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go index 9db9b1fd5dec..6dabb2dd144e 100644 --- a/azurerm/resource_arm_bastion_host.go +++ b/azurerm/resource_arm_bastion_host.go @@ -5,14 +5,12 @@ import ( "log" "regexp" - "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network" - "github.com/hashicorp/terraform/helper/schema" - + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -51,8 +49,9 @@ func resourceArmBastionHost() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validateAzureRMBastionIPConfigName, }, "subnet_id": { Type: schema.TypeString, @@ -74,7 +73,7 @@ func resourceArmBastionHost() *schema.Resource { } func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{}) error { - client := meta.(*ArmClient).network.BastionHostsClient + client := meta.(*ArmClient).Network.BastionHostsClient ctx := meta.(*ArmClient).StopContext log.Println("[INFO] preparing arguments for Azure Bastion Host creation.") @@ -126,7 +125,7 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} } func resourceArmBastionHostRead(d *schema.ResourceData, meta interface{}) error { - client := meta.(*ArmClient).network.BastionHostsClient + client := meta.(*ArmClient).Network.BastionHostsClient ctx := meta.(*ArmClient).StopContext id, err := azure.ParseAzureResourceID(d.Id()) @@ -169,7 +168,7 @@ func resourceArmBastionHostRead(d *schema.ResourceData, meta interface{}) error } func resourceArmBastionHostDelete(d *schema.ResourceData, meta interface{}) error { - client := meta.(*ArmClient).network.BastionHostsClient + client := meta.(*ArmClient).Network.BastionHostsClient ctx := meta.(*ArmClient).StopContext id, err := parseAzureResourceID(d.Id()) @@ -211,6 +210,23 @@ func validateAzureRMBastionHostName(v interface{}, k string) (warnings []string, return warnings, errors } +func validateAzureRMBastionIPConfigName(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf("lowercase letters, highercase letters numbers only are allowed in %q: %q", k, value)) + } + + if 1 > len(value) { + errors = append(errors, fmt.Errorf("%q cannot be less than 1 characters: %q", k, value)) + } + + if len(value) > 32 { + errors = append(errors, fmt.Errorf("%q cannot be longer than 32 characters: %q %d", k, value, len(value))) + } + + return warnings, errors +} + func expandArmBastionHostIPConfiguration(input []interface{}) (ipConfigs []network.BastionHostIPConfiguration) { if len(input) == 0 { return nil diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go index 3d4e7a2046f2..bb8bef885aa1 100644 --- a/azurerm/resource_arm_bastion_host_test.go +++ b/azurerm/resource_arm_bastion_host_test.go @@ -2,14 +2,14 @@ package azurerm import ( "fmt" + "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" - "testing" ) func TestAccAzureRMBastionHost_basic(t *testing.T) { @@ -197,7 +197,7 @@ resource "azurerm_bastion_host" "import" { func testCheckAzureRMBastionHostExists(resourceName string) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(*ArmClient).network.BastionHostsClient + client := testAccProvider.Meta().(*ArmClient).Network.BastionHostsClient ctx := testAccProvider.Meta().(*ArmClient).StopContext rs, ok := s.RootModule().Resources[resourceName] @@ -221,7 +221,7 @@ func testCheckAzureRMBastionHostExists(resourceName string) resource.TestCheckFu } func testCheckAzureRMBastionHostDestroy(s *terraform.State) error { - client := testAccProvider.Meta().(*ArmClient).network.BastionHostsClient + client := testAccProvider.Meta().(*ArmClient).Network.BastionHostsClient ctx := testAccProvider.Meta().(*ArmClient).StopContext for _, rs := range s.RootModule().Resources { From 3765ff8972f7f96c7abdcf512305b069cfae652a Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Tue, 8 Oct 2019 09:51:18 +0100 Subject: [PATCH 17/19] go fmt provider.go for travis ci err --- azurerm/provider.go | 394 ++++++++++++++++++++++---------------------- 1 file changed, 197 insertions(+), 197 deletions(-) diff --git a/azurerm/provider.go b/azurerm/provider.go index a52887224161..b1912fef249a 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -148,203 +148,203 @@ func Provider() terraform.ResourceProvider { } resources := map[string]*schema.Resource{ - "azurerm_analysis_services_server": resourceArmAnalysisServicesServer(), - "azurerm_api_management": resourceArmApiManagementService(), - "azurerm_api_management_api": resourceArmApiManagementApi(), - "azurerm_api_management_api_operation": resourceArmApiManagementApiOperation(), - "azurerm_api_management_api_operation_policy": resourceArmApiManagementApiOperationPolicy(), - "azurerm_api_management_api_policy": resourceArmApiManagementApiPolicy(), - "azurerm_api_management_api_schema": resourceArmApiManagementApiSchema(), - "azurerm_api_management_api_version_set": resourceArmApiManagementApiVersionSet(), - "azurerm_api_management_authorization_server": resourceArmApiManagementAuthorizationServer(), - "azurerm_api_management_backend": resourceArmApiManagementBackend(), - "azurerm_api_management_certificate": resourceArmApiManagementCertificate(), - "azurerm_api_management_group": resourceArmApiManagementGroup(), - "azurerm_api_management_group_user": resourceArmApiManagementGroupUser(), - "azurerm_api_management_logger": resourceArmApiManagementLogger(), - "azurerm_api_management_openid_connect_provider": resourceArmApiManagementOpenIDConnectProvider(), - "azurerm_api_management_product": resourceArmApiManagementProduct(), - "azurerm_api_management_product_api": resourceArmApiManagementProductApi(), - "azurerm_api_management_product_group": resourceArmApiManagementProductGroup(), - "azurerm_api_management_product_policy": resourceArmApiManagementProductPolicy(), - "azurerm_api_management_property": resourceArmApiManagementProperty(), - "azurerm_api_management_subscription": resourceArmApiManagementSubscription(), - "azurerm_api_management_user": resourceArmApiManagementUser(), - "azurerm_app_service_active_slot": resourceArmAppServiceActiveSlot(), - "azurerm_app_service_certificate": resourceArmAppServiceCertificate(), - "azurerm_app_service_custom_hostname_binding": resourceArmAppServiceCustomHostnameBinding(), - "azurerm_app_service_plan": resourceArmAppServicePlan(), - "azurerm_app_service_slot": resourceArmAppServiceSlot(), - "azurerm_app_service_source_control_token": resourceArmAppServiceSourceControlToken(), - "azurerm_app_service": resourceArmAppService(), - "azurerm_application_gateway": resourceArmApplicationGateway(), - "azurerm_application_insights_api_key": resourceArmApplicationInsightsAPIKey(), - "azurerm_application_insights": resourceArmApplicationInsights(), - "azurerm_application_insights_analytics_item": resourceArmApplicationInsightsAnalyticsItem(), - "azurerm_application_insights_web_test": resourceArmApplicationInsightsWebTests(), - "azurerm_application_security_group": resourceArmApplicationSecurityGroup(), - "azurerm_automation_account": resourceArmAutomationAccount(), - "azurerm_automation_credential": resourceArmAutomationCredential(), - "azurerm_automation_dsc_configuration": resourceArmAutomationDscConfiguration(), - "azurerm_automation_dsc_nodeconfiguration": resourceArmAutomationDscNodeConfiguration(), - "azurerm_automation_module": resourceArmAutomationModule(), - "azurerm_automation_runbook": resourceArmAutomationRunbook(), - "azurerm_automation_schedule": resourceArmAutomationSchedule(), - "azurerm_automation_variable_bool": resourceArmAutomationVariableBool(), - "azurerm_automation_variable_datetime": resourceArmAutomationVariableDateTime(), - "azurerm_automation_variable_int": resourceArmAutomationVariableInt(), - "azurerm_automation_variable_string": resourceArmAutomationVariableString(), - "azurerm_autoscale_setting": resourceArmAutoScaleSetting(), - "azurerm_availability_set": resourceArmAvailabilitySet(), - "azurerm_azuread_application": resourceArmActiveDirectoryApplication(), - "azurerm_azuread_service_principal_password": resourceArmActiveDirectoryServicePrincipalPassword(), - "azurerm_azuread_service_principal": resourceArmActiveDirectoryServicePrincipal(), - "azurerm_bastion_host": resourceArmBastionHost(), - "azurerm_batch_account": resourceArmBatchAccount(), - "azurerm_batch_application": resourceArmBatchApplication(), - "azurerm_batch_certificate": resourceArmBatchCertificate(), - "azurerm_bot_channel_email": resourceArmBotChannelEmail(), - "azurerm_bot_channel_slack": resourceArmBotChannelSlack(), - "azurerm_bot_channels_registration": resourceArmBotChannelsRegistration(), - "azurerm_bot_connection": resourceArmBotConnection(), - "azurerm_bot_web_app": resourceArmBotWebApp(), - "azurerm_batch_pool": resourceArmBatchPool(), - "azurerm_cdn_endpoint": resourceArmCdnEndpoint(), - "azurerm_cdn_profile": resourceArmCdnProfile(), - "azurerm_cognitive_account": resourceArmCognitiveAccount(), - "azurerm_connection_monitor": resourceArmConnectionMonitor(), - "azurerm_container_group": resourceArmContainerGroup(), - "azurerm_container_registry_webhook": resourceArmContainerRegistryWebhook(), - "azurerm_container_registry": resourceArmContainerRegistry(), - "azurerm_container_service": resourceArmContainerService(), - "azurerm_cosmosdb_account": resourceArmCosmosDbAccount(), - "azurerm_cosmosdb_cassandra_keyspace": resourceArmCosmosDbCassandraKeyspace(), - "azurerm_cosmosdb_mongo_collection": resourceArmCosmosDbMongoCollection(), - "azurerm_cosmosdb_mongo_database": resourceArmCosmosDbMongoDatabase(), - "azurerm_cosmosdb_sql_container": resourceArmCosmosDbSQLContainer(), - "azurerm_cosmosdb_sql_database": resourceArmCosmosDbSQLDatabase(), - "azurerm_cosmosdb_table": resourceArmCosmosDbTable(), - "azurerm_dashboard": resourceArmDashboard(), - "azurerm_data_factory": resourceArmDataFactory(), - "azurerm_data_factory_dataset_mysql": resourceArmDataFactoryDatasetMySQL(), - "azurerm_data_factory_dataset_postgresql": resourceArmDataFactoryDatasetPostgreSQL(), - "azurerm_data_factory_dataset_sql_server_table": resourceArmDataFactoryDatasetSQLServerTable(), - "azurerm_data_factory_linked_service_data_lake_storage_gen2": resourceArmDataFactoryLinkedServiceDataLakeStorageGen2(), - "azurerm_data_factory_linked_service_mysql": resourceArmDataFactoryLinkedServiceMySQL(), - "azurerm_data_factory_linked_service_postgresql": resourceArmDataFactoryLinkedServicePostgreSQL(), - "azurerm_data_factory_linked_service_sql_server": resourceArmDataFactoryLinkedServiceSQLServer(), - "azurerm_data_factory_pipeline": resourceArmDataFactoryPipeline(), - "azurerm_data_lake_analytics_account": resourceArmDataLakeAnalyticsAccount(), - "azurerm_data_lake_analytics_firewall_rule": resourceArmDataLakeAnalyticsFirewallRule(), - "azurerm_data_lake_store_file": resourceArmDataLakeStoreFile(), - "azurerm_data_lake_store_firewall_rule": resourceArmDataLakeStoreFirewallRule(), - "azurerm_data_lake_store": resourceArmDataLakeStore(), - "azurerm_databricks_workspace": resourceArmDatabricksWorkspace(), - "azurerm_ddos_protection_plan": resourceArmDDoSProtectionPlan(), - "azurerm_dev_test_lab": resourceArmDevTestLab(), - "azurerm_dev_test_schedule": resourceArmDevTestLabSchedules(), - "azurerm_dev_test_linux_virtual_machine": resourceArmDevTestLinuxVirtualMachine(), - "azurerm_dev_test_policy": resourceArmDevTestPolicy(), - "azurerm_dev_test_virtual_network": resourceArmDevTestVirtualNetwork(), - "azurerm_dev_test_windows_virtual_machine": resourceArmDevTestWindowsVirtualMachine(), - "azurerm_devspace_controller": resourceArmDevSpaceController(), - "azurerm_dns_a_record": resourceArmDnsARecord(), - "azurerm_dns_aaaa_record": resourceArmDnsAAAARecord(), - "azurerm_dns_caa_record": resourceArmDnsCaaRecord(), - "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_domain": resourceArmEventGridDomain(), - "azurerm_eventgrid_event_subscription": resourceArmEventGridEventSubscription(), - "azurerm_eventgrid_topic": resourceArmEventGridTopic(), - "azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(), - "azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(), - "azurerm_eventhub_namespace_authorization_rule": resourceArmEventHubNamespaceAuthorizationRule(), - "azurerm_eventhub_namespace_disaster_recovery_config": resourceArmEventHubNamespaceDisasterRecoveryConfig(), - "azurerm_eventhub_namespace": resourceArmEventHubNamespace(), - "azurerm_eventhub": resourceArmEventHub(), - "azurerm_express_route_circuit_authorization": resourceArmExpressRouteCircuitAuthorization(), - "azurerm_express_route_circuit_peering": resourceArmExpressRouteCircuitPeering(), - "azurerm_express_route_circuit": resourceArmExpressRouteCircuit(), - "azurerm_firewall_application_rule_collection": resourceArmFirewallApplicationRuleCollection(), - "azurerm_firewall_nat_rule_collection": resourceArmFirewallNatRuleCollection(), - "azurerm_firewall_network_rule_collection": resourceArmFirewallNetworkRuleCollection(), - "azurerm_firewall": resourceArmFirewall(), - "azurerm_frontdoor": resourceArmFrontDoor(), - "azurerm_frontdoor_firewall_policy": resourceArmFrontDoorFirewallPolicy(), - "azurerm_function_app": resourceArmFunctionApp(), - "azurerm_hdinsight_hadoop_cluster": resourceArmHDInsightHadoopCluster(), - "azurerm_hdinsight_hbase_cluster": resourceArmHDInsightHBaseCluster(), - "azurerm_hdinsight_interactive_query_cluster": resourceArmHDInsightInteractiveQueryCluster(), - "azurerm_hdinsight_kafka_cluster": resourceArmHDInsightKafkaCluster(), - "azurerm_hdinsight_ml_services_cluster": resourceArmHDInsightMLServicesCluster(), - "azurerm_hdinsight_rserver_cluster": resourceArmHDInsightRServerCluster(), - "azurerm_hdinsight_spark_cluster": resourceArmHDInsightSparkCluster(), - "azurerm_hdinsight_storm_cluster": resourceArmHDInsightStormCluster(), - "azurerm_image": resourceArmImage(), - "azurerm_iot_dps": resourceArmIotDPS(), - "azurerm_iot_dps_certificate": resourceArmIotDPSCertificate(), - "azurerm_iothub_consumer_group": resourceArmIotHubConsumerGroup(), - "azurerm_iothub": resourceArmIotHub(), - "azurerm_iothub_shared_access_policy": resourceArmIotHubSharedAccessPolicy(), - "azurerm_key_vault_access_policy": resourceArmKeyVaultAccessPolicy(), - "azurerm_key_vault_certificate": resourceArmKeyVaultCertificate(), - "azurerm_key_vault_key": resourceArmKeyVaultKey(), - "azurerm_key_vault_secret": resourceArmKeyVaultSecret(), - "azurerm_key_vault": resourceArmKeyVault(), - "azurerm_kubernetes_cluster": resourceArmKubernetesCluster(), - "azurerm_kusto_cluster": resourceArmKustoCluster(), - "azurerm_kusto_database": resourceArmKustoDatabase(), - "azurerm_lb_backend_address_pool": resourceArmLoadBalancerBackendAddressPool(), - "azurerm_lb_nat_pool": resourceArmLoadBalancerNatPool(), - "azurerm_lb_nat_rule": resourceArmLoadBalancerNatRule(), - "azurerm_lb_probe": resourceArmLoadBalancerProbe(), - "azurerm_lb_outbound_rule": resourceArmLoadBalancerOutboundRule(), - "azurerm_lb_rule": resourceArmLoadBalancerRule(), - "azurerm_lb": resourceArmLoadBalancer(), - "azurerm_local_network_gateway": resourceArmLocalNetworkGateway(), - "azurerm_log_analytics_solution": resourceArmLogAnalyticsSolution(), - "azurerm_log_analytics_linked_service": resourceArmLogAnalyticsLinkedService(), - "azurerm_log_analytics_workspace_linked_service": resourceArmLogAnalyticsWorkspaceLinkedService(), - "azurerm_log_analytics_workspace": resourceArmLogAnalyticsWorkspace(), - "azurerm_logic_app_action_custom": resourceArmLogicAppActionCustom(), - "azurerm_logic_app_action_http": resourceArmLogicAppActionHTTP(), - "azurerm_logic_app_trigger_custom": resourceArmLogicAppTriggerCustom(), - "azurerm_logic_app_trigger_http_request": resourceArmLogicAppTriggerHttpRequest(), - "azurerm_logic_app_trigger_recurrence": resourceArmLogicAppTriggerRecurrence(), - "azurerm_logic_app_workflow": resourceArmLogicAppWorkflow(), - "azurerm_managed_disk": resourceArmManagedDisk(), - "azurerm_management_group": resourceArmManagementGroup(), - "azurerm_management_lock": resourceArmManagementLock(), - "azurerm_maps_account": resourceArmMapsAccount(), - "azurerm_mariadb_configuration": resourceArmMariaDbConfiguration(), - "azurerm_mariadb_database": resourceArmMariaDbDatabase(), - "azurerm_mariadb_firewall_rule": resourceArmMariaDBFirewallRule(), - "azurerm_mariadb_server": resourceArmMariaDbServer(), - "azurerm_mariadb_virtual_network_rule": resourceArmMariaDbVirtualNetworkRule(), - "azurerm_marketplace_agreement": resourceArmMarketplaceAgreement(), - "azurerm_media_services_account": resourceArmMediaServicesAccount(), - "azurerm_metric_alertrule": resourceArmMetricAlertRule(), - "azurerm_monitor_autoscale_setting": resourceArmMonitorAutoScaleSetting(), - "azurerm_monitor_action_group": resourceArmMonitorActionGroup(), - "azurerm_monitor_activity_log_alert": resourceArmMonitorActivityLogAlert(), - "azurerm_monitor_diagnostic_setting": resourceArmMonitorDiagnosticSetting(), - "azurerm_monitor_log_profile": resourceArmMonitorLogProfile(), - "azurerm_monitor_metric_alert": resourceArmMonitorMetricAlert(), - "azurerm_monitor_metric_alertrule": resourceArmMonitorMetricAlertRule(), - "azurerm_mssql_elasticpool": resourceArmMsSqlElasticPool(), - "azurerm_mysql_configuration": resourceArmMySQLConfiguration(), - "azurerm_mysql_database": resourceArmMySqlDatabase(), - "azurerm_mysql_firewall_rule": resourceArmMySqlFirewallRule(), - "azurerm_mysql_server": resourceArmMySqlServer(), - "azurerm_mysql_virtual_network_rule": resourceArmMySqlVirtualNetworkRule(), - "azurerm_network_connection_monitor": resourceArmNetworkConnectionMonitor(), - "azurerm_network_ddos_protection_plan": resourceArmNetworkDDoSProtectionPlan(), - "azurerm_network_interface": resourceArmNetworkInterface(), + "azurerm_analysis_services_server": resourceArmAnalysisServicesServer(), + "azurerm_api_management": resourceArmApiManagementService(), + "azurerm_api_management_api": resourceArmApiManagementApi(), + "azurerm_api_management_api_operation": resourceArmApiManagementApiOperation(), + "azurerm_api_management_api_operation_policy": resourceArmApiManagementApiOperationPolicy(), + "azurerm_api_management_api_policy": resourceArmApiManagementApiPolicy(), + "azurerm_api_management_api_schema": resourceArmApiManagementApiSchema(), + "azurerm_api_management_api_version_set": resourceArmApiManagementApiVersionSet(), + "azurerm_api_management_authorization_server": resourceArmApiManagementAuthorizationServer(), + "azurerm_api_management_backend": resourceArmApiManagementBackend(), + "azurerm_api_management_certificate": resourceArmApiManagementCertificate(), + "azurerm_api_management_group": resourceArmApiManagementGroup(), + "azurerm_api_management_group_user": resourceArmApiManagementGroupUser(), + "azurerm_api_management_logger": resourceArmApiManagementLogger(), + "azurerm_api_management_openid_connect_provider": resourceArmApiManagementOpenIDConnectProvider(), + "azurerm_api_management_product": resourceArmApiManagementProduct(), + "azurerm_api_management_product_api": resourceArmApiManagementProductApi(), + "azurerm_api_management_product_group": resourceArmApiManagementProductGroup(), + "azurerm_api_management_product_policy": resourceArmApiManagementProductPolicy(), + "azurerm_api_management_property": resourceArmApiManagementProperty(), + "azurerm_api_management_subscription": resourceArmApiManagementSubscription(), + "azurerm_api_management_user": resourceArmApiManagementUser(), + "azurerm_app_service_active_slot": resourceArmAppServiceActiveSlot(), + "azurerm_app_service_certificate": resourceArmAppServiceCertificate(), + "azurerm_app_service_custom_hostname_binding": resourceArmAppServiceCustomHostnameBinding(), + "azurerm_app_service_plan": resourceArmAppServicePlan(), + "azurerm_app_service_slot": resourceArmAppServiceSlot(), + "azurerm_app_service_source_control_token": resourceArmAppServiceSourceControlToken(), + "azurerm_app_service": resourceArmAppService(), + "azurerm_application_gateway": resourceArmApplicationGateway(), + "azurerm_application_insights_api_key": resourceArmApplicationInsightsAPIKey(), + "azurerm_application_insights": resourceArmApplicationInsights(), + "azurerm_application_insights_analytics_item": resourceArmApplicationInsightsAnalyticsItem(), + "azurerm_application_insights_web_test": resourceArmApplicationInsightsWebTests(), + "azurerm_application_security_group": resourceArmApplicationSecurityGroup(), + "azurerm_automation_account": resourceArmAutomationAccount(), + "azurerm_automation_credential": resourceArmAutomationCredential(), + "azurerm_automation_dsc_configuration": resourceArmAutomationDscConfiguration(), + "azurerm_automation_dsc_nodeconfiguration": resourceArmAutomationDscNodeConfiguration(), + "azurerm_automation_module": resourceArmAutomationModule(), + "azurerm_automation_runbook": resourceArmAutomationRunbook(), + "azurerm_automation_schedule": resourceArmAutomationSchedule(), + "azurerm_automation_variable_bool": resourceArmAutomationVariableBool(), + "azurerm_automation_variable_datetime": resourceArmAutomationVariableDateTime(), + "azurerm_automation_variable_int": resourceArmAutomationVariableInt(), + "azurerm_automation_variable_string": resourceArmAutomationVariableString(), + "azurerm_autoscale_setting": resourceArmAutoScaleSetting(), + "azurerm_availability_set": resourceArmAvailabilitySet(), + "azurerm_azuread_application": resourceArmActiveDirectoryApplication(), + "azurerm_azuread_service_principal_password": resourceArmActiveDirectoryServicePrincipalPassword(), + "azurerm_azuread_service_principal": resourceArmActiveDirectoryServicePrincipal(), + "azurerm_bastion_host": resourceArmBastionHost(), + "azurerm_batch_account": resourceArmBatchAccount(), + "azurerm_batch_application": resourceArmBatchApplication(), + "azurerm_batch_certificate": resourceArmBatchCertificate(), + "azurerm_bot_channel_email": resourceArmBotChannelEmail(), + "azurerm_bot_channel_slack": resourceArmBotChannelSlack(), + "azurerm_bot_channels_registration": resourceArmBotChannelsRegistration(), + "azurerm_bot_connection": resourceArmBotConnection(), + "azurerm_bot_web_app": resourceArmBotWebApp(), + "azurerm_batch_pool": resourceArmBatchPool(), + "azurerm_cdn_endpoint": resourceArmCdnEndpoint(), + "azurerm_cdn_profile": resourceArmCdnProfile(), + "azurerm_cognitive_account": resourceArmCognitiveAccount(), + "azurerm_connection_monitor": resourceArmConnectionMonitor(), + "azurerm_container_group": resourceArmContainerGroup(), + "azurerm_container_registry_webhook": resourceArmContainerRegistryWebhook(), + "azurerm_container_registry": resourceArmContainerRegistry(), + "azurerm_container_service": resourceArmContainerService(), + "azurerm_cosmosdb_account": resourceArmCosmosDbAccount(), + "azurerm_cosmosdb_cassandra_keyspace": resourceArmCosmosDbCassandraKeyspace(), + "azurerm_cosmosdb_mongo_collection": resourceArmCosmosDbMongoCollection(), + "azurerm_cosmosdb_mongo_database": resourceArmCosmosDbMongoDatabase(), + "azurerm_cosmosdb_sql_container": resourceArmCosmosDbSQLContainer(), + "azurerm_cosmosdb_sql_database": resourceArmCosmosDbSQLDatabase(), + "azurerm_cosmosdb_table": resourceArmCosmosDbTable(), + "azurerm_dashboard": resourceArmDashboard(), + "azurerm_data_factory": resourceArmDataFactory(), + "azurerm_data_factory_dataset_mysql": resourceArmDataFactoryDatasetMySQL(), + "azurerm_data_factory_dataset_postgresql": resourceArmDataFactoryDatasetPostgreSQL(), + "azurerm_data_factory_dataset_sql_server_table": resourceArmDataFactoryDatasetSQLServerTable(), + "azurerm_data_factory_linked_service_data_lake_storage_gen2": resourceArmDataFactoryLinkedServiceDataLakeStorageGen2(), + "azurerm_data_factory_linked_service_mysql": resourceArmDataFactoryLinkedServiceMySQL(), + "azurerm_data_factory_linked_service_postgresql": resourceArmDataFactoryLinkedServicePostgreSQL(), + "azurerm_data_factory_linked_service_sql_server": resourceArmDataFactoryLinkedServiceSQLServer(), + "azurerm_data_factory_pipeline": resourceArmDataFactoryPipeline(), + "azurerm_data_lake_analytics_account": resourceArmDataLakeAnalyticsAccount(), + "azurerm_data_lake_analytics_firewall_rule": resourceArmDataLakeAnalyticsFirewallRule(), + "azurerm_data_lake_store_file": resourceArmDataLakeStoreFile(), + "azurerm_data_lake_store_firewall_rule": resourceArmDataLakeStoreFirewallRule(), + "azurerm_data_lake_store": resourceArmDataLakeStore(), + "azurerm_databricks_workspace": resourceArmDatabricksWorkspace(), + "azurerm_ddos_protection_plan": resourceArmDDoSProtectionPlan(), + "azurerm_dev_test_lab": resourceArmDevTestLab(), + "azurerm_dev_test_schedule": resourceArmDevTestLabSchedules(), + "azurerm_dev_test_linux_virtual_machine": resourceArmDevTestLinuxVirtualMachine(), + "azurerm_dev_test_policy": resourceArmDevTestPolicy(), + "azurerm_dev_test_virtual_network": resourceArmDevTestVirtualNetwork(), + "azurerm_dev_test_windows_virtual_machine": resourceArmDevTestWindowsVirtualMachine(), + "azurerm_devspace_controller": resourceArmDevSpaceController(), + "azurerm_dns_a_record": resourceArmDnsARecord(), + "azurerm_dns_aaaa_record": resourceArmDnsAAAARecord(), + "azurerm_dns_caa_record": resourceArmDnsCaaRecord(), + "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_domain": resourceArmEventGridDomain(), + "azurerm_eventgrid_event_subscription": resourceArmEventGridEventSubscription(), + "azurerm_eventgrid_topic": resourceArmEventGridTopic(), + "azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(), + "azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(), + "azurerm_eventhub_namespace_authorization_rule": resourceArmEventHubNamespaceAuthorizationRule(), + "azurerm_eventhub_namespace_disaster_recovery_config": resourceArmEventHubNamespaceDisasterRecoveryConfig(), + "azurerm_eventhub_namespace": resourceArmEventHubNamespace(), + "azurerm_eventhub": resourceArmEventHub(), + "azurerm_express_route_circuit_authorization": resourceArmExpressRouteCircuitAuthorization(), + "azurerm_express_route_circuit_peering": resourceArmExpressRouteCircuitPeering(), + "azurerm_express_route_circuit": resourceArmExpressRouteCircuit(), + "azurerm_firewall_application_rule_collection": resourceArmFirewallApplicationRuleCollection(), + "azurerm_firewall_nat_rule_collection": resourceArmFirewallNatRuleCollection(), + "azurerm_firewall_network_rule_collection": resourceArmFirewallNetworkRuleCollection(), + "azurerm_firewall": resourceArmFirewall(), + "azurerm_frontdoor": resourceArmFrontDoor(), + "azurerm_frontdoor_firewall_policy": resourceArmFrontDoorFirewallPolicy(), + "azurerm_function_app": resourceArmFunctionApp(), + "azurerm_hdinsight_hadoop_cluster": resourceArmHDInsightHadoopCluster(), + "azurerm_hdinsight_hbase_cluster": resourceArmHDInsightHBaseCluster(), + "azurerm_hdinsight_interactive_query_cluster": resourceArmHDInsightInteractiveQueryCluster(), + "azurerm_hdinsight_kafka_cluster": resourceArmHDInsightKafkaCluster(), + "azurerm_hdinsight_ml_services_cluster": resourceArmHDInsightMLServicesCluster(), + "azurerm_hdinsight_rserver_cluster": resourceArmHDInsightRServerCluster(), + "azurerm_hdinsight_spark_cluster": resourceArmHDInsightSparkCluster(), + "azurerm_hdinsight_storm_cluster": resourceArmHDInsightStormCluster(), + "azurerm_image": resourceArmImage(), + "azurerm_iot_dps": resourceArmIotDPS(), + "azurerm_iot_dps_certificate": resourceArmIotDPSCertificate(), + "azurerm_iothub_consumer_group": resourceArmIotHubConsumerGroup(), + "azurerm_iothub": resourceArmIotHub(), + "azurerm_iothub_shared_access_policy": resourceArmIotHubSharedAccessPolicy(), + "azurerm_key_vault_access_policy": resourceArmKeyVaultAccessPolicy(), + "azurerm_key_vault_certificate": resourceArmKeyVaultCertificate(), + "azurerm_key_vault_key": resourceArmKeyVaultKey(), + "azurerm_key_vault_secret": resourceArmKeyVaultSecret(), + "azurerm_key_vault": resourceArmKeyVault(), + "azurerm_kubernetes_cluster": resourceArmKubernetesCluster(), + "azurerm_kusto_cluster": resourceArmKustoCluster(), + "azurerm_kusto_database": resourceArmKustoDatabase(), + "azurerm_lb_backend_address_pool": resourceArmLoadBalancerBackendAddressPool(), + "azurerm_lb_nat_pool": resourceArmLoadBalancerNatPool(), + "azurerm_lb_nat_rule": resourceArmLoadBalancerNatRule(), + "azurerm_lb_probe": resourceArmLoadBalancerProbe(), + "azurerm_lb_outbound_rule": resourceArmLoadBalancerOutboundRule(), + "azurerm_lb_rule": resourceArmLoadBalancerRule(), + "azurerm_lb": resourceArmLoadBalancer(), + "azurerm_local_network_gateway": resourceArmLocalNetworkGateway(), + "azurerm_log_analytics_solution": resourceArmLogAnalyticsSolution(), + "azurerm_log_analytics_linked_service": resourceArmLogAnalyticsLinkedService(), + "azurerm_log_analytics_workspace_linked_service": resourceArmLogAnalyticsWorkspaceLinkedService(), + "azurerm_log_analytics_workspace": resourceArmLogAnalyticsWorkspace(), + "azurerm_logic_app_action_custom": resourceArmLogicAppActionCustom(), + "azurerm_logic_app_action_http": resourceArmLogicAppActionHTTP(), + "azurerm_logic_app_trigger_custom": resourceArmLogicAppTriggerCustom(), + "azurerm_logic_app_trigger_http_request": resourceArmLogicAppTriggerHttpRequest(), + "azurerm_logic_app_trigger_recurrence": resourceArmLogicAppTriggerRecurrence(), + "azurerm_logic_app_workflow": resourceArmLogicAppWorkflow(), + "azurerm_managed_disk": resourceArmManagedDisk(), + "azurerm_management_group": resourceArmManagementGroup(), + "azurerm_management_lock": resourceArmManagementLock(), + "azurerm_maps_account": resourceArmMapsAccount(), + "azurerm_mariadb_configuration": resourceArmMariaDbConfiguration(), + "azurerm_mariadb_database": resourceArmMariaDbDatabase(), + "azurerm_mariadb_firewall_rule": resourceArmMariaDBFirewallRule(), + "azurerm_mariadb_server": resourceArmMariaDbServer(), + "azurerm_mariadb_virtual_network_rule": resourceArmMariaDbVirtualNetworkRule(), + "azurerm_marketplace_agreement": resourceArmMarketplaceAgreement(), + "azurerm_media_services_account": resourceArmMediaServicesAccount(), + "azurerm_metric_alertrule": resourceArmMetricAlertRule(), + "azurerm_monitor_autoscale_setting": resourceArmMonitorAutoScaleSetting(), + "azurerm_monitor_action_group": resourceArmMonitorActionGroup(), + "azurerm_monitor_activity_log_alert": resourceArmMonitorActivityLogAlert(), + "azurerm_monitor_diagnostic_setting": resourceArmMonitorDiagnosticSetting(), + "azurerm_monitor_log_profile": resourceArmMonitorLogProfile(), + "azurerm_monitor_metric_alert": resourceArmMonitorMetricAlert(), + "azurerm_monitor_metric_alertrule": resourceArmMonitorMetricAlertRule(), + "azurerm_mssql_elasticpool": resourceArmMsSqlElasticPool(), + "azurerm_mysql_configuration": resourceArmMySQLConfiguration(), + "azurerm_mysql_database": resourceArmMySqlDatabase(), + "azurerm_mysql_firewall_rule": resourceArmMySqlFirewallRule(), + "azurerm_mysql_server": resourceArmMySqlServer(), + "azurerm_mysql_virtual_network_rule": resourceArmMySqlVirtualNetworkRule(), + "azurerm_network_connection_monitor": resourceArmNetworkConnectionMonitor(), + "azurerm_network_ddos_protection_plan": resourceArmNetworkDDoSProtectionPlan(), + "azurerm_network_interface": resourceArmNetworkInterface(), "azurerm_network_interface_application_gateway_backend_address_pool_association": resourceArmNetworkInterfaceApplicationGatewayBackendAddressPoolAssociation(), "azurerm_network_interface_application_security_group_association": resourceArmNetworkInterfaceApplicationSecurityGroupAssociation(), "azurerm_network_interface_backend_address_pool_association": resourceArmNetworkInterfaceBackendAddressPoolAssociation(), From 9d4326de762c997d08cb425e6e0fd0ba49c674b7 Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Wed, 9 Oct 2019 19:29:54 +0100 Subject: [PATCH 18/19] move dns_name, expandipconfig pointer return, import test add, rename test rg bastion --- azurerm/resource_arm_bastion_host.go | 17 ++++++++--------- azurerm/resource_arm_bastion_host_test.go | 9 +++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go index 6dabb2dd144e..4324bb65dccb 100644 --- a/azurerm/resource_arm_bastion_host.go +++ b/azurerm/resource_arm_bastion_host.go @@ -36,11 +36,6 @@ func resourceArmBastionHost() *schema.Resource { "resource_group_name": azure.SchemaResourceGroupName(), - "dns_name": { - Type: schema.TypeString, - Computed: true, - }, - "ip_configuration": { Type: schema.TypeList, ForceNew: true, @@ -67,6 +62,11 @@ func resourceArmBastionHost() *schema.Resource { }, }, + "dns_name": { + Type: schema.TypeString, + Computed: true, + }, + "tags": tags.Schema(), }, } @@ -96,11 +96,10 @@ func resourceArmBastionHostCreateUpdate(d *schema.ResourceData, meta interface{} } } - ipconfig := expandArmBastionHostIPConfiguration(d.Get("ip_configuration").([]interface{})) parameters := network.BastionHost{ Location: &location, BastionHostPropertiesFormat: &network.BastionHostPropertiesFormat{ - IPConfigurations: &ipconfig, + IPConfigurations: expandArmBastionHostIPConfiguration(d.Get("ip_configuration").([]interface{})), }, Tags: expandTags(tags), } @@ -227,7 +226,7 @@ func validateAzureRMBastionIPConfigName(v interface{}, k string) (warnings []str return warnings, errors } -func expandArmBastionHostIPConfiguration(input []interface{}) (ipConfigs []network.BastionHostIPConfiguration) { +func expandArmBastionHostIPConfiguration(input []interface{}) (ipConfigs *[]network.BastionHostIPConfiguration) { if len(input) == 0 { return nil } @@ -237,7 +236,7 @@ func expandArmBastionHostIPConfiguration(input []interface{}) (ipConfigs []netwo subID := property["subnet_id"].(string) pipID := property["public_ip_address_id"].(string) - return []network.BastionHostIPConfiguration{ + return &[]network.BastionHostIPConfiguration{ { Name: &ipConfName, BastionHostIPConfigurationPropertiesFormat: &network.BastionHostIPConfigurationPropertiesFormat{ diff --git a/azurerm/resource_arm_bastion_host_test.go b/azurerm/resource_arm_bastion_host_test.go index bb8bef885aa1..59c3dc28135d 100644 --- a/azurerm/resource_arm_bastion_host_test.go +++ b/azurerm/resource_arm_bastion_host_test.go @@ -54,6 +54,11 @@ func TestAccAzureRMBastionHost_complete(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "tags.environment", "production"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -90,7 +95,7 @@ func TestAccAzureRMBastionHost_requiresImport(t *testing.T) { func testAccAzureRMBastionHost_basic(rInt int, rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-bastion-%d" location = "%s" } @@ -133,7 +138,7 @@ resource "azurerm_bastion_host" "test" { func testAccAzureRMBastionHost_complete(rInt int, rString string, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-bastion-%d" location = "%s" } From 8c26237141b4f572a3f099ed98b159acf2dd47cd Mon Sep 17 00:00:00 2001 From: danielmabbett <15195905+DanielMabbett@users.noreply.github.com> Date: Thu, 10 Oct 2019 09:22:17 +0100 Subject: [PATCH 19/19] remove whitespace --- azurerm/resource_arm_bastion_host.go | 1 - 1 file changed, 1 deletion(-) diff --git a/azurerm/resource_arm_bastion_host.go b/azurerm/resource_arm_bastion_host.go index 4324bb65dccb..a7fe13888098 100644 --- a/azurerm/resource_arm_bastion_host.go +++ b/azurerm/resource_arm_bastion_host.go @@ -156,7 +156,6 @@ func resourceArmBastionHostRead(d *schema.ResourceData, meta interface{}) error d.Set("dns_name", props.DNSName) if ipConfigs := props.IPConfigurations; ipConfigs != nil { - if err := d.Set("ip_configuration", flattenArmBastionHostIPConfiguration(ipConfigs)); err != nil { return fmt.Errorf("Error flattening `ip_configuration`: %+v", err) }