Skip to content

Commit

Permalink
merge with upstream/main
Browse files Browse the repository at this point in the history
  • Loading branch information
vmanilo committed Feb 1, 2024
1 parent 352da71 commit fbbe906
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
19 changes: 19 additions & 0 deletions twingate/internal/test/acctests/resource/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,22 @@ func TestAccRemoteConnectorCreateWithNotificationStatusFalse(t *testing.T) {
},
})
}

func terraformResourceTwingateConnectorWithNotificationStatus(terraformRemoteNetworkName, terraformConnectorName, remoteNetworkName string, notificationStatus bool) string {
return fmt.Sprintf(`
%s
resource "twingate_connector" "%s" {
remote_network_id = twingate_remote_network.%s.id
status_updates_enabled = %v
}
`, terraformResourceRemoteNetwork(terraformRemoteNetworkName, remoteNetworkName), terraformConnectorName, terraformRemoteNetworkName, notificationStatus)
}

func terraformResourceRemoteNetwork(terraformResourceName, name string) string {
return fmt.Sprintf(`
resource "twingate_remote_network" "%s" {
name = "%s"
}
`, terraformResourceName, name)
}
7 changes: 4 additions & 3 deletions twingate/internal/test/acctests/resource/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1031,30 +1031,31 @@ func TestAccTwingateResourceAddAccessGroupsAndServiceAccounts(t *testing.T) {
groups, groupsID := genNewGroups(terraformResource, 1)
serviceAccountConfig := []string{configServiceAccount(terraformResource, test.RandomName())}
serviceAccountID := []string{acctests.TerraformServiceAccount(terraformResource) + ".id"}
resourceName := test.RandomName()

sdk.Test(t, sdk.TestCase{
ProtoV6ProviderFactories: acctests.ProviderFactories,
PreCheck: func() { acctests.PreCheck(t) },
CheckDestroy: acctests.CheckTwingateResourceDestroy,
Steps: []sdk.TestStep{
{
Config: configResourceWithGroupsAndServiceAccounts(terraformResource, test.RandomName(), test.RandomResourceName(), groups, groupsID, serviceAccountConfig, serviceAccountID),
Config: configResourceWithGroupsAndServiceAccounts(terraformResource, resourceName, test.RandomResourceName(), groups, groupsID, serviceAccountConfig, serviceAccountID),
Check: acctests.ComposeTestCheckFunc(
acctests.CheckTwingateResourceExists(theResource),
sdk.TestCheckResourceAttr(theResource, accessGroupIdsLen, "1"),
sdk.TestCheckResourceAttr(theResource, accessServiceAccountIdsLen, "1"),
),
},
{
Config: createResource16WithoutServiceAccounts(remoteNetworkName, resourceName, groups, groupsID, createServiceAccount(resourceName, serviceAccountName)),
Config: createResource16WithoutServiceAccounts(terraformResource, resourceName, groups, groupsID, serviceAccountConfig[0]),
Check: acctests.ComposeTestCheckFunc(
acctests.CheckTwingateResourceExists(theResource),
sdk.TestCheckResourceAttr(theResource, accessGroupIdsLen, "1"),
sdk.TestCheckResourceAttr(theResource, accessServiceAccountIdsLen, "0"),
),
},
{
Config: createResource16WithoutGroups(remoteNetworkName, resourceName, groups, groupsID, createServiceAccount(resourceName, serviceAccountName)),
Config: createResource16WithoutGroups(terraformResource, resourceName, groups, groupsID, serviceAccountConfig[0]),
Check: acctests.ComposeTestCheckFunc(
acctests.CheckTwingateResourceExists(theResource),
sdk.TestCheckResourceAttr(theResource, accessGroupIdsLen, "0"),
Expand Down

0 comments on commit fbbe906

Please sign in to comment.