diff --git a/azurerm/internal/services/vmware/client/client.go b/azurerm/internal/services/vmware/client/client.go index 07532c5f5e12..e5643228adaa 100644 --- a/azurerm/internal/services/vmware/client/client.go +++ b/azurerm/internal/services/vmware/client/client.go @@ -6,8 +6,9 @@ import ( ) type Client struct { - PrivateCloudClient *avs.PrivateCloudsClient - ClusterClient *avs.ClustersClient + PrivateCloudClient *avs.PrivateCloudsClient + ClusterClient *avs.ClustersClient + AuthorizationClient *avs.AuthorizationsClient } func NewClient(o *common.ClientOptions) *Client { @@ -17,8 +18,12 @@ func NewClient(o *common.ClientOptions) *Client { clusterClient := avs.NewClustersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&clusterClient.Client, o.ResourceManagerAuthorizer) + authorizationClient := avs.NewAuthorizationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&authorizationClient.Client, o.ResourceManagerAuthorizer) + return &Client{ - PrivateCloudClient: &privateCloudClient, - ClusterClient: &clusterClient, + PrivateCloudClient: &privateCloudClient, + ClusterClient: &clusterClient, + AuthorizationClient: &authorizationClient, } } diff --git a/azurerm/internal/services/vmware/parse/express_route_authorization.go b/azurerm/internal/services/vmware/parse/express_route_authorization.go new file mode 100644 index 000000000000..3264a52b453d --- /dev/null +++ b/azurerm/internal/services/vmware/parse/express_route_authorization.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" +) + +type ExpressRouteAuthorizationId struct { + SubscriptionId string + ResourceGroup string + PrivateCloudName string + AuthorizationName string +} + +func NewExpressRouteAuthorizationID(subscriptionId, resourceGroup, privateCloudName, authorizationName string) ExpressRouteAuthorizationId { + return ExpressRouteAuthorizationId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + PrivateCloudName: privateCloudName, + AuthorizationName: authorizationName, + } +} + +func (id ExpressRouteAuthorizationId) String() string { + segments := []string{ + fmt.Sprintf("Authorization Name %q", id.AuthorizationName), + fmt.Sprintf("Private Cloud Name %q", id.PrivateCloudName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Express Route Authorization", segmentsStr) +} + +func (id ExpressRouteAuthorizationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AVS/privateClouds/%s/authorizations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PrivateCloudName, id.AuthorizationName) +} + +// ExpressRouteAuthorizationID parses a ExpressRouteAuthorization ID into an ExpressRouteAuthorizationId struct +func ExpressRouteAuthorizationID(input string) (*ExpressRouteAuthorizationId, error) { + id, err := azure.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := ExpressRouteAuthorizationId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.PrivateCloudName, err = id.PopSegment("privateClouds"); err != nil { + return nil, err + } + if resourceId.AuthorizationName, err = id.PopSegment("authorizations"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/azurerm/internal/services/vmware/parse/express_route_authorization_test.go b/azurerm/internal/services/vmware/parse/express_route_authorization_test.go new file mode 100644 index 000000000000..608d4953289a --- /dev/null +++ b/azurerm/internal/services/vmware/parse/express_route_authorization_test.go @@ -0,0 +1,128 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/resourceid" +) + +var _ resourceid.Formatter = ExpressRouteAuthorizationId{} + +func TestExpressRouteAuthorizationIDFormatter(t *testing.T) { + actual := NewExpressRouteAuthorizationID("12345678-1234-9876-4563-123456789012", "group1", "privateCloud1", "authorization1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1/authorizations/authorization1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestExpressRouteAuthorizationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExpressRouteAuthorizationId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing PrivateCloudName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/", + Error: true, + }, + + { + // missing value for PrivateCloudName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/", + Error: true, + }, + + { + // missing AuthorizationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1/", + Error: true, + }, + + { + // missing value for AuthorizationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1/authorizations/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1/authorizations/authorization1", + Expected: &ExpressRouteAuthorizationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "group1", + PrivateCloudName: "privateCloud1", + AuthorizationName: "authorization1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.AVS/PRIVATECLOUDS/PRIVATECLOUD1/AUTHORIZATIONS/AUTHORIZATION1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ExpressRouteAuthorizationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.PrivateCloudName != v.Expected.PrivateCloudName { + t.Fatalf("Expected %q but got %q for PrivateCloudName", v.Expected.PrivateCloudName, actual.PrivateCloudName) + } + if actual.AuthorizationName != v.Expected.AuthorizationName { + t.Fatalf("Expected %q but got %q for AuthorizationName", v.Expected.AuthorizationName, actual.AuthorizationName) + } + } +} diff --git a/azurerm/internal/services/vmware/registration.go b/azurerm/internal/services/vmware/registration.go index 1671d8544e18..fae7872a2df3 100644 --- a/azurerm/internal/services/vmware/registration.go +++ b/azurerm/internal/services/vmware/registration.go @@ -26,7 +26,8 @@ func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { // SupportedResources returns the supported Resources supported by this Service func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ - "azurerm_vmware_private_cloud": resourceVmwarePrivateCloud(), - "azurerm_vmware_cluster": resourceVmwareCluster(), + "azurerm_vmware_private_cloud": resourceVmwarePrivateCloud(), + "azurerm_vmware_cluster": resourceVmwareCluster(), + "azurerm_vmware_express_route_authorization": resourceVmwareExpressRouteAuthorization(), } } diff --git a/azurerm/internal/services/vmware/resourceids.go b/azurerm/internal/services/vmware/resourceids.go index 6831d26becc7..36d2fe9d6a7c 100644 --- a/azurerm/internal/services/vmware/resourceids.go +++ b/azurerm/internal/services/vmware/resourceids.go @@ -2,3 +2,4 @@ package vmware //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=PrivateCloud -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Cluster -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1/clusters/cluster1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ExpressRouteAuthorization -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1/authorizations/authorization1 diff --git a/azurerm/internal/services/vmware/validate/express_route_authorization_id.go b/azurerm/internal/services/vmware/validate/express_route_authorization_id.go new file mode 100644 index 000000000000..9c39daf76a0c --- /dev/null +++ b/azurerm/internal/services/vmware/validate/express_route_authorization_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/vmware/parse" +) + +func ExpressRouteAuthorizationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.ExpressRouteAuthorizationID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/azurerm/internal/services/vmware/validate/express_route_authorization_id_test.go b/azurerm/internal/services/vmware/validate/express_route_authorization_id_test.go new file mode 100644 index 000000000000..26ae035bf3f0 --- /dev/null +++ b/azurerm/internal/services/vmware/validate/express_route_authorization_id_test.go @@ -0,0 +1,88 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestExpressRouteAuthorizationID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing PrivateCloudName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/", + Valid: false, + }, + + { + // missing value for PrivateCloudName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/", + Valid: false, + }, + + { + // missing AuthorizationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1/", + Valid: false, + }, + + { + // missing value for AuthorizationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1/authorizations/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/privateCloud1/authorizations/authorization1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.AVS/PRIVATECLOUDS/PRIVATECLOUD1/AUTHORIZATIONS/AUTHORIZATION1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := ExpressRouteAuthorizationID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/azurerm/internal/services/vmware/vmware_express_route_authorization_resource.go b/azurerm/internal/services/vmware/vmware_express_route_authorization_resource.go new file mode 100644 index 000000000000..2a134d6d8d43 --- /dev/null +++ b/azurerm/internal/services/vmware/vmware_express_route_authorization_resource.go @@ -0,0 +1,152 @@ +package vmware + +import ( + "fmt" + "log" + "time" + + "github.com/Azure/azure-sdk-for-go/services/avs/mgmt/2020-03-20/avs" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/vmware/parse" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/vmware/validate" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/pluginsdk" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceVmwareExpressRouteAuthorization() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceVmwareExpressRouteAuthorizationCreate, + Read: resourceVmwareExpressRouteAuthorizationRead, + Delete: resourceVmwareExpressRouteAuthorizationDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.ExpressRouteAuthorizationID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "private_cloud_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.PrivateCloudID, + }, + + "express_route_authorization_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "express_route_authorization_key": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + }, + } +} +func resourceVmwareExpressRouteAuthorizationCreate(d *pluginsdk.ResourceData, meta interface{}) error { + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + client := meta.(*clients.Client).Vmware.AuthorizationClient + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + name := d.Get("name").(string) + privateCloudId, err := parse.PrivateCloudID(d.Get("private_cloud_id").(string)) + if err != nil { + return err + } + + id := parse.NewExpressRouteAuthorizationID(subscriptionId, privateCloudId.ResourceGroup, privateCloudId.Name, name) + + existing, err := client.Get(ctx, id.ResourceGroup, id.PrivateCloudName, id.AuthorizationName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for present of existing %q : %+v", id.ID(), err) + } + } + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_vmware_express_route_authorization", id.ID()) + } + + props := avs.ExpressRouteAuthorization{} + + future, err := client.CreateOrUpdate(ctx, privateCloudId.ResourceGroup, privateCloudId.Name, name, props) + if err != nil { + return fmt.Errorf("creating %q: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the creation of the %q: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceVmwareExpressRouteAuthorizationRead(d, meta) +} + +func resourceVmwareExpressRouteAuthorizationRead(d *pluginsdk.ResourceData, meta interface{}) error { + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + client := meta.(*clients.Client).Vmware.AuthorizationClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.ExpressRouteAuthorizationID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.PrivateCloudName, id.AuthorizationName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] avs %q does not exist - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %q: %+v", id, err) + } + + d.Set("name", id.AuthorizationName) + d.Set("private_cloud_id", parse.NewPrivateCloudID(subscriptionId, id.ResourceGroup, id.PrivateCloudName).ID()) + if props := resp.ExpressRouteAuthorizationProperties; props != nil { + d.Set("express_route_authorization_id", props.ExpressRouteAuthorizationID) + d.Set("express_route_authorization_key", props.ExpressRouteAuthorizationKey) + } + return nil +} + +func resourceVmwareExpressRouteAuthorizationDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Vmware.AuthorizationClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.ExpressRouteAuthorizationID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.PrivateCloudName, id.AuthorizationName) + if err != nil { + return fmt.Errorf("deleting %q: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the deletion of the %q: %+v", id, err) + } + return nil +} diff --git a/azurerm/internal/services/vmware/vmware_express_route_authorization_resource_test.go b/azurerm/internal/services/vmware/vmware_express_route_authorization_resource_test.go new file mode 100644 index 000000000000..bea36e6eafe4 --- /dev/null +++ b/azurerm/internal/services/vmware/vmware_express_route_authorization_resource_test.go @@ -0,0 +1,85 @@ +package vmware_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance/check" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/vmware/parse" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +type VmwareExpressRouteAuthorizationResource struct { +} + +func TestAccVmwareExpressRouteAuthorization_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_vmware_express_route_authorization", "test") + r := VmwareExpressRouteAuthorizationResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("express_route_authorization_id").Exists(), + check.That(data.ResourceName).Key("express_route_authorization_key").Exists(), + ), + }, + data.ImportStep(), + }) +} + +func TestAccVmwareExpressRouteAuthorization_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_vmware_express_route_authorization", "test") + r := VmwareExpressRouteAuthorizationResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (VmwareExpressRouteAuthorizationResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { + id, err := parse.ExpressRouteAuthorizationID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.Vmware.AuthorizationClient.Get(ctx, id.ResourceGroup, id.PrivateCloudName, id.AuthorizationName) + if err != nil { + return nil, fmt.Errorf("retrieving %q: %+v", id, err) + } + + return utils.Bool(resp.ExpressRouteAuthorizationProperties != nil), nil +} + +func (r VmwareExpressRouteAuthorizationResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_vmware_express_route_authorization" "test" { + name = "acctest-VmwareAuthorization-%d" + private_cloud_id = azurerm_vmware_private_cloud.test.id +} +`, VmwarePrivateCloudResource{}.basic(data), data.RandomInteger) +} + +func (r VmwareExpressRouteAuthorizationResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_vmware_express_route_authorization" "import" { + name = azurerm_vmware_express_route_authorization.test.name + private_cloud_id = azurerm_vmware_private_cloud.test.id +} +`, r.basic(data)) +} diff --git a/website/docs/r/vmware_express_route_authorization.html.markdown b/website/docs/r/vmware_express_route_authorization.html.markdown new file mode 100644 index 000000000000..dca828ecc495 --- /dev/null +++ b/website/docs/r/vmware_express_route_authorization.html.markdown @@ -0,0 +1,80 @@ +--- +subcategory: "VMware (AVS)" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_vmware_express_route_authorization" +description: |- + Manages an Express Route Vmware Authorization. +--- + +# azurerm_vmware_express_route_authorization + +Manages an Express Route Vmware Authorization. + +## Example Usage + +```hcl +provider "azurerm" { + features {} + disable_correlation_request_id = true +} + +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_vmware_private_cloud" "example" { + name = "example-vmware-private-cloud" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + sku_name = "av36" + + management_cluster { + size = 3 + } + + network_subnet_cidr = "192.168.48.0/22" + internet_connection_enabled = false + nsxt_password = "QazWsx13$Edc" + vcenter_password = "WsxEdc23$Rfv" +} + +resource "azurerm_vmware_express_route_authorization" "example" { + name = "example-authorization" + private_cloud_id = azurerm_vmware_private_cloud.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Express Route Vmware Authorization. Changing this forces a new Vmware Authorization to be created. + +* `private_cloud_id` - (Required) The ID of the Vmware Private Cloud in which to create this Express Route Vmware Authorization. Changing this forces a new Vmware Authorization to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Vmware Authorization. + +* `express_route_authorization_id` - The ID of the Express Route Circuit Authorization. + +* `express_route_authorization_key` - The key of the Express Route Circuit Authorization. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Vmware Authorization. +* `read` - (Defaults to 5 minutes) Used when retrieving the Vmware Authorization. +* `delete` - (Defaults to 30 minutes) Used when deleting the Vmware Authorization. + +## Import + +Vmware Authorizations can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_vmware_express_route_authorization.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.AVS/privateClouds/privateCloud1/authorizations/authorization1 +```