Skip to content

Commit

Permalink
fix review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
teowa committed Sep 7, 2023
1 parent 5bc03d9 commit bb47ff3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ func (r ResourceManagementPrivateLinkResource) ModelObject() interface{} {
}

type ResourceManagementPrivateLinkResourceSchema struct {
Location string `tfschema:"location"`
Name string `tfschema:"name"`
PrivateEndpointConnections []string `tfschema:"private_endpoint_connections"`
ResourceGroupName string `tfschema:"resource_group_name"`
Location string `tfschema:"location"`
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
}

func (r ResourceManagementPrivateLinkResource) IDValidationFunc() pluginsdk.SchemaValidateFunc {
Expand All @@ -52,15 +51,7 @@ func (r ResourceManagementPrivateLinkResource) Arguments() map[string]*pluginsdk
}

func (r ResourceManagementPrivateLinkResource) Attributes() map[string]*pluginsdk.Schema {
return map[string]*pluginsdk.Schema{
"private_endpoint_connections": {
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
Type: pluginsdk.TypeList,
},
}
return map[string]*pluginsdk.Schema{}
}

func (r ResourceManagementPrivateLinkResource) Create() sdk.ResourceFunc {
Expand Down Expand Up @@ -107,7 +98,6 @@ func (r ResourceManagementPrivateLinkResource) Read() sdk.ResourceFunc {
Timeout: 5 * time.Minute,
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
client := metadata.Client.Resource.ResourceManagementPrivateLinkClient
schema := ResourceManagementPrivateLinkResourceSchema{}

id, err := resourcemanagementprivatelink.ParseResourceManagementPrivateLinkID(metadata.ResourceData.Id())
if err != nil {
Expand All @@ -122,9 +112,12 @@ func (r ResourceManagementPrivateLinkResource) Read() sdk.ResourceFunc {
return fmt.Errorf("retrieving %s: %+v", *id, err)
}

schema := ResourceManagementPrivateLinkResourceSchema{
Name: id.ResourceManagementPrivateLinkName,
ResourceGroupName: id.ResourceGroupName,
}

if model := resp.Model; model != nil {
schema.Name = id.ResourceManagementPrivateLinkName
schema.ResourceGroupName = id.ResourceGroupName
schema.Location = location.NormalizeNilable(model.Location)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func (r ResourceManagementPrivateLinkTestResource) Exists(ctx context.Context, c

func (r ResourceManagementPrivateLinkTestResource) basic(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
%s
resource "azurerm_resource_management_private_link" "test" {
Expand All @@ -73,6 +77,10 @@ resource "azurerm_resource_management_private_link" "test" {

func (r ResourceManagementPrivateLinkTestResource) requiresImport(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
%s
resource "azurerm_resource_management_private_link" "import" {
Expand All @@ -95,10 +103,6 @@ variable "random_string" {
default = %q
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestrg-${var.random_integer}"
location = var.primary_location
Expand Down
6 changes: 2 additions & 4 deletions website/docs/r/resource_management_private_link.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ subcategory: "Management"
layout: "azurerm"
page_title: "Azure Resource Manager: azurerm_resource_management_private_link"
description: |-
Manages a Resource Management Private Link.
Manages a Resource Management Private Link to restrict access for managing resources in your Subscriptions.
---

# azurerm_resource_management_private_link

Manages a Resource Management Private Link.
Manages a Resource Management Private Link to restrict access for managing resources in your Subscriptions.

## Example Usage

Expand Down Expand Up @@ -40,8 +40,6 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `id` - The ID of the Resource Management Private Link.

* `private_endpoint_connections` - A list of private endpoint connections.

---

## Timeouts
Expand Down

0 comments on commit bb47ff3

Please sign in to comment.