Skip to content

Commit

Permalink
HCPCP-1928 Change platform resource unique name identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonpilz committed Dec 10, 2024
1 parent 420a6a4 commit daeea8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions internal/providersdkv2/resource_aws_network_peering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"fmt"
"testing"
"time"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
Expand All @@ -16,7 +15,7 @@ import (

var (
// using unique names for AWS resource to make debugging easier
hvnPeeringUniqueAWSName = fmt.Sprintf("hcp-provider-test-%s", time.Now().Format("200601021504"))
hvnPeeringUniqueAWSName = testAccPlatformUniqueName()
testAccAwsPeeringConfig = fmt.Sprintf(`
provider "aws" {
region = "us-west-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"fmt"
"testing"
"time"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
Expand All @@ -16,8 +15,8 @@ import (

var (
// using unique names for AWS resource to make debugging easier
tgwAttUniqueAWSName = fmt.Sprintf("hcp-att-unique-test-%s", time.Now().Format("200601021504"))
tgwAttUniqueHvnName = fmt.Sprintf("att-hvn-name-%s", time.Now().Format("200601021504"))
tgwAttUniqueAWSName = testAccPlatformUniqueName()
tgwAttUniqueHvnName = testAccPlatformUniqueName()
testAccTGWAttachmentConfig = fmt.Sprintf(`
provider "aws" {
region = "us-west-2"
Expand Down
11 changes: 9 additions & 2 deletions internal/providersdkv2/resource_hvn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"context"
"fmt"
"testing"
"time"

"github.com/google/uuid"

sharedmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
Expand All @@ -16,7 +17,7 @@ import (
)

var (
hvnUniqueID = fmt.Sprintf("hcp-provider-test-%s", time.Now().Format("200601021504"))
hvnUniqueID = testAccPlatformUniqueName()
)

var testAccAwsHvnConfig = fmt.Sprintf(`
Expand Down Expand Up @@ -44,6 +45,12 @@ data "hcp_hvn" "test" {
}
`, hvnUniqueID)

func testAccPlatformUniqueName() string {
shortUuid := uuid.New().String()[0:8]

Check failure on line 49 in internal/providersdkv2/resource_hvn_test.go

View workflow job for this annotation

GitHub Actions / Unit Test and Lint

ST1003: var shortUuid should be shortUUID (stylecheck)

return fmt.Sprintf("testacc-platform-%s", shortUuid)
}

// This includes tests against both the resource and the corresponding datasource
// to shorten testing time.
func TestAcc_Platform_Hvn_Aws(t *testing.T) {
Expand Down

0 comments on commit daeea8c

Please sign in to comment.