-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import openstack_networking_port_secgroup_associate_v2 (#1415)
Add test and documentation for importing a openstack_networking_port_secgroup_associate_v2 resource.
- Loading branch information
1 parent
92a0a86
commit 504fb15
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
openstack/import_openstack_networking_port_secgroup_associate_v2_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package openstack | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccNetworkingV2PortSecgroupAssociate_import(t *testing.T) { | ||
resourceName := "openstack_networking_port_secgroup_associate_v2.port_1" | ||
|
||
if os.Getenv("TF_ACC") != "" { | ||
hiddenPort, err := testAccCheckNetworkingV2PortSecGroupCreatePort(t, "hidden_port", true) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
defer testAccCheckNetworkingV2PortSecGroupDeletePort(t, hiddenPort) //nolint:errcheck | ||
} | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { | ||
testAccPreCheck(t) | ||
testAccPreCheckNonAdminOnly(t) | ||
}, | ||
ProviderFactories: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccNetworkingV2PortSecGroupAssociateManifestUpdate0(), | ||
}, | ||
|
||
{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"security_group_ids"}, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters