Skip to content

Commit

Permalink
Fix private_link_endpoint import (TERRA-73)
Browse files Browse the repository at this point in the history
  • Loading branch information
emerkle826 committed Jul 11, 2022
1 parent 431a075 commit 9298f45
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion docs/resources/private_link_endpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,12 @@ resource "astra_private_link_endpoint" "az_private_link_endpoint" {
Import is supported using the following syntax:

```shell
terraform import astra_private_link_endpoint.example a6bc9c26-e7ce-424f-84c7-0a00afb12588
# Amazon AWS example
terraform import astra_private_link_endpoint.example a6bc9c26-e7ce-424f-84c7-0a00afb12588/datacenter/a6bc9c26-e7ce-424f-84c7-0a00afb12588-1/endpoint/vpce-0f7aed6e7a18a1791

# Google GCP example
terraform import astra_private_link_endpoint.example a6bc9c26-e7ce-424f-84c7-0a00afb12588/datacenter/a6bc9c26-e7ce-424f-84c7-0a00afb12588-1/endpoint/13585698993864708

# Azure EKS example
terraform import astra_private_link_endpoint.example a6bc9c26-e7ce-424f-84c7-0a00afb12588/datacenter/a6bc9c26-e7ce-424f-84c7-0a00afb12588-1/endpoint/dc5ee5b1-4fc2-463e-a56b-ff54dd38b879/providers/Microsoft.Network/privateEndpoints/private-endpoint-example
```
9 changes: 8 additions & 1 deletion examples/resources/astra_private_link_endpoint/import.sh
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
terraform import astra_private_link_endpoint.example a6bc9c26-e7ce-424f-84c7-0a00afb12588
# Amazon AWS example
terraform import astra_private_link_endpoint.example a6bc9c26-e7ce-424f-84c7-0a00afb12588/datacenter/a6bc9c26-e7ce-424f-84c7-0a00afb12588-1/endpoint/vpce-0f7aed6e7a18a1791

# Google GCP example
terraform import astra_private_link_endpoint.example a6bc9c26-e7ce-424f-84c7-0a00afb12588/datacenter/a6bc9c26-e7ce-424f-84c7-0a00afb12588-1/endpoint/13585698993864708

# Azure EKS example
terraform import astra_private_link_endpoint.example a6bc9c26-e7ce-424f-84c7-0a00afb12588/datacenter/a6bc9c26-e7ce-424f-84c7-0a00afb12588-1/endpoint/dc5ee5b1-4fc2-463e-a56b-ff54dd38b879/providers/Microsoft.Network/privateEndpoints/private-endpoint-example
2 changes: 1 addition & 1 deletion internal/provider/resource_private_link_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func resourcePrivateLinkEndpointRead(ctx context.Context, d *schema.ResourceData
}

var astraEndpointIDStr string
if astraEndpointID == nil {
if astraEndpointID == nil || astraEndpointID == "" {
// set it to the endpointID
astraEndpointIDStr = endpointID
} else {
Expand Down

0 comments on commit 9298f45

Please sign in to comment.