Skip to content

Commit

Permalink
networkmanager
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Oct 25, 2024
1 parent 6e9762b commit 72102d8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 58 deletions.
17 changes: 3 additions & 14 deletions internal/service/networkmanager/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func testAccConnection_basic(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccConnectionImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
},
Expand Down Expand Up @@ -108,7 +108,7 @@ func testAccConnection_tags(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccConnectionImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -157,7 +157,7 @@ func testAccConnection_descriptionAndLinks(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccConnectionImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -397,14 +397,3 @@ resource "aws_networkmanager_connection" "test" {
}
`, rName))
}

func testAccConnectionImportStateIdFunc(resourceName string) resource.ImportStateIdFunc {
return func(s *terraform.State) (string, error) {
rs, ok := s.RootModule().Resources[resourceName]
if !ok {
return "", fmt.Errorf("Not found: %s", resourceName)
}

return rs.Primary.Attributes[names.AttrARN], nil
}
}
19 changes: 4 additions & 15 deletions internal/service/networkmanager/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestAccNetworkManagerDevice_basic(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccDeviceImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
},
Expand Down Expand Up @@ -100,7 +100,7 @@ func TestAccNetworkManagerDevice_tags(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccDeviceImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestAccNetworkManagerDevice_allAttributes(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccDeviceImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestAccNetworkManagerDevice_awsLocation(t *testing.T) { // nosemgrep:ci.aws
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccDeviceImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -488,14 +488,3 @@ resource "aws_networkmanager_device" "test" {
}
`, rName))
}

func testAccDeviceImportStateIdFunc(resourceName string) resource.ImportStateIdFunc {
return func(s *terraform.State) (string, error) {
rs, ok := s.RootModule().Resources[resourceName]
if !ok {
return "", fmt.Errorf("Not found: %s", resourceName)
}

return rs.Primary.Attributes[names.AttrARN], nil
}
}
17 changes: 3 additions & 14 deletions internal/service/networkmanager/link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestAccNetworkManagerLink_basic(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccLinkImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
},
Expand Down Expand Up @@ -98,7 +98,7 @@ func TestAccNetworkManagerLink_tags(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccLinkImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestAccNetworkManagerLink_allAttributes(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccLinkImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -376,14 +376,3 @@ resource "aws_networkmanager_link" "test" {
}
`, rName)
}

func testAccLinkImportStateIdFunc(resourceName string) resource.ImportStateIdFunc {
return func(s *terraform.State) (string, error) {
rs, ok := s.RootModule().Resources[resourceName]
if !ok {
return "", fmt.Errorf("Not found: %s", resourceName)
}

return rs.Primary.Attributes[names.AttrARN], nil
}
}
19 changes: 4 additions & 15 deletions internal/service/networkmanager/site_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestAccNetworkManagerSite_basic(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccSiteImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
},
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestAccNetworkManagerSite_tags(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccSiteImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -139,7 +139,7 @@ func TestAccNetworkManagerSite_description(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccSiteImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -177,7 +177,7 @@ func TestAccNetworkManagerSite_location(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateIdFunc: testAccSiteImportStateIdFunc(resourceName),
ImportStateIdFunc: acctest.AttrImportStateIdFunc(resourceName, names.AttrARN),
ImportStateVerify: true,
},
{
Expand Down Expand Up @@ -356,14 +356,3 @@ resource "aws_networkmanager_site" "test" {
}
`, rName)
}

func testAccSiteImportStateIdFunc(resourceName string) resource.ImportStateIdFunc {
return func(s *terraform.State) (string, error) {
rs, ok := s.RootModule().Resources[resourceName]
if !ok {
return "", fmt.Errorf("Not found: %s", resourceName)
}

return rs.Primary.Attributes[names.AttrARN], nil
}
}

0 comments on commit 72102d8

Please sign in to comment.