Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ resource "citrix_application" "example-application" {
- `limit_to_one_instance_per_user` (Boolean) Specifies if the use of the application should be limited to only one instance per user. Default is `false`.
- `limit_visibility_to_users` (Set of String) By default, the application is visible to all users within a delivery group. However, you can restrict its visibility to only certain users by specifying them in the `limit_visibility_to_users` list.

-> **Note** Users must be in `DOMAIN\UserOrGroupName` or `user@domain.com` format
-> **Note** Users must be in SID, SAM account name (`DOMAIN\UserOrGroupName`) or UPN (`user@domain.com`) format
- `max_total_instances` (Number) Control the use of this application by limiting the number of instances running at the same time. If set to 0, it allows unlimited use.
- `metadata` (Attributes List) Metadata for the Application. (see [below for nested schema](#nestedatt--metadata))
- `shortcut_added_to_desktop` (Boolean) Indicates whether a shortcut to the application is added to the desktop. Default is `false`.
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/application_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "citrix_application_group" "example-application-group" {
- `enabled` (Boolean) Whether the application group is enabled or not. Defaults to `true`.
- `included_users` (Set of String) Users who can use this application group.

-> **Note** User must be in `Domain\UserOrGroupName` or `user@domain.com` format
-> **Note** User must be in SID, SAM account name (`DOMAIN\UserOrGroupName`) or UPN (`user@domain.com`) format
- `metadata` (Attributes List) Metadata for the Application Group. (see [below for nested schema](#nestedatt--metadata))
- `restrict_to_tag` (String) The tag to restrict the application group to.
- `scopes` (Set of String) The IDs of the scopes for the application group to be a part of.
Expand Down
10 changes: 5 additions & 5 deletions docs/resources/delivery_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ Required:
- `machine_name` (String) The name of the machine. For domain-joined machines, the name must be in the format <domain>\<machine>, all in lowercase. For non domain-joined machines, use the machine name, all in lowercase.
- `users` (Set of String) The list of users to assign to the machine.

-> **Note** Users must be in `DOMAIN\UserName` or `user@domain.com` format.
-> **Note** Users must be in SID, SAM account name (`DOMAIN\UserName`) or UPN (`user@domain.com`) format.


<a id="nestedatt--associated_machine_catalogs"></a>
Expand Down Expand Up @@ -531,10 +531,10 @@ Optional:

- `allow_list` (Set of String) Users who can use this Desktop.

-> **Note** Users must be in `DOMAIN\UserOrGroupName` or `user@domain.com` format
-> **Note** Users must be in SID, SAM account name (`DOMAIN\UserOrGroupName`) or UPN (`user@domain.com`) format
- `block_list` (Set of String) Users who cannot use this Desktop. A block list is meaningful only when used to block users in the allow list.

-> **Note** Users must be in `DOMAIN\UserOrGroupName` or `user@domain.com` format
-> **Note** Users must be in SID, SAM account name (`DOMAIN\UserOrGroupName`) or UPN (`user@domain.com`) format



Expand Down Expand Up @@ -601,10 +601,10 @@ Optional:

- `allow_list` (Set of String) Users who can use this Delivery Group.

-> **Note** Users must be in `DOMAIN\UserOrGroupName` or `user@domain.com` format
-> **Note** Users must be in SID, SAM account name (`DOMAIN\UserOrGroupName`) or UPN (`user@domain.com`) format
- `block_list` (Set of String) Users who cannot use this Delivery Group. A block list is meaningful only when used to block users in the allow list.

-> **Note** Users must be in `DOMAIN\UserOrGroupName` or `user@domain.com` format
-> **Note** Users must be in SID, SAM account name (`DOMAIN\UserOrGroupName`) or UPN (`user@domain.com`) format

## Import

Expand Down
4 changes: 2 additions & 2 deletions internal/daas/application/application_group_resource_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ func (ApplicationGroupResourceModel) GetSchema() schema.Schema {
"included_users": schema.SetAttribute{
ElementType: types.StringType,
Description: "Users who can use this application group. " +
"\n\n-> **Note** User must be in `Domain\\UserOrGroupName` or `user@domain.com` format",
"\n\n-> **Note** User must be in SID, SAM account name (`DOMAIN\\UserOrGroupName`) or UPN (`user@domain.com`) format",
Optional: true,
Validators: []validator.Set{
setvalidator.ValueStringsAre(
validator.String(
stringvalidator.RegexMatches(regexp.MustCompile(util.SamAndUpnRegex), "must be in `Domain\\UserOrGroupName` or `user@domain.com` format"),
stringvalidator.RegexMatches(regexp.MustCompile(util.SamUpnSidRegex), "must be in SID, SAM account name (`DOMAIN\\UserOrGroupName`) or UPN (`user@domain.com`) format"),
),
),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/daas/application/application_resource_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ func (ApplicationResourceModel) GetSchema() schema.Schema {
"limit_visibility_to_users": schema.SetAttribute{
ElementType: types.StringType,
Description: "By default, the application is visible to all users within a delivery group. However, you can restrict its visibility to only certain users by specifying them in the `limit_visibility_to_users` list." +
"\n\n-> **Note** Users must be in `DOMAIN\\UserOrGroupName` or `user@domain.com` format",
"\n\n-> **Note** Users must be in SID, SAM account name (`DOMAIN\\UserOrGroupName`) or UPN (`user@domain.com`) format",
Optional: true,
Validators: []validator.Set{
setvalidator.ValueStringsAre(
validator.String(
stringvalidator.RegexMatches(regexp.MustCompile(util.SamAndUpnRegex), "must be in `Domain\\UserOrGroupName` or `user@domain.com` format"),
stringvalidator.RegexMatches(regexp.MustCompile(util.SamUpnSidRegex), "must be in SID, SAM account name (`DOMAIN\\UserOrGroupName`) or UPN (`user@domain.com`) format"),
),
),
},
Expand Down
12 changes: 6 additions & 6 deletions internal/daas/delivery_group/delivery_group_resource_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,28 +688,28 @@ func (RestrictedAccessUsers) getSchemaInternal(forDeliveryGroup bool) schema.Sin
Attributes: map[string]schema.Attribute{
"allow_list": schema.SetAttribute{
ElementType: types.StringType,
Description: fmt.Sprintf("Users who can use this %s. \n\n-> **Note** Users must be in `DOMAIN\\UserOrGroupName` or `user@domain.com` format", resource),
Description: fmt.Sprintf("Users who can use this %s. \n\n-> **Note** Users must be in SID, SAM account name (`DOMAIN\\UserOrGroupName`) or UPN (`user@domain.com`) format", resource),
Optional: true,
Computed: true,
Default: setdefault.StaticValue(types.SetValueMust(types.StringType, []attr.Value{})),
Validators: []validator.Set{
setvalidator.ValueStringsAre(
validator.String(
stringvalidator.RegexMatches(regexp.MustCompile(util.SamAndUpnRegex), "must be in `DOMAIN\\UserOrGroupName` or `user@domain.com` format"),
stringvalidator.RegexMatches(regexp.MustCompile(util.SamUpnSidRegex), "must be in SID, SAM account name (`DOMAIN\\UserOrGroupName`) or UPN (`user@domain.com`) format"),
),
),
},
},
"block_list": schema.SetAttribute{
ElementType: types.StringType,
Description: fmt.Sprintf("Users who cannot use this %s. A block list is meaningful only when used to block users in the allow list. \n\n-> **Note** Users must be in `DOMAIN\\UserOrGroupName` or `user@domain.com` format", resource),
Description: fmt.Sprintf("Users who cannot use this %s. A block list is meaningful only when used to block users in the allow list. \n\n-> **Note** Users must be in SID, SAM account name (`DOMAIN\\UserOrGroupName`) or UPN (`user@domain.com`) format", resource),
Optional: true,
Computed: true,
Default: setdefault.StaticValue(types.SetValueMust(types.StringType, []attr.Value{})),
Validators: []validator.Set{
setvalidator.ValueStringsAre(
validator.String(
stringvalidator.RegexMatches(regexp.MustCompile(util.SamAndUpnRegex), "must be in `DOMAIN\\UserOrGroupName` or `user@domain.com` format"),
stringvalidator.RegexMatches(regexp.MustCompile(util.SamUpnSidRegex), "must be in SID, SAM account name (`DOMAIN\\UserOrGroupName`) or UPN (`user@domain.com`) format"),
),
),
},
Expand Down Expand Up @@ -1030,13 +1030,13 @@ func (DeliveryGroupAssignMachinesToUsersModel) GetSchema() schema.NestedAttribut
},
"users": schema.SetAttribute{
ElementType: types.StringType,
Description: "The list of users to assign to the machine. \n\n-> **Note** Users must be in `DOMAIN\\UserName` or `user@domain.com` format.",
Description: "The list of users to assign to the machine. \n\n-> **Note** Users must be in SID, SAM account name (`DOMAIN\\UserName`) or UPN (`user@domain.com`) format.",
Required: true,
Validators: []validator.Set{
setvalidator.SizeAtLeast(1),
setvalidator.ValueStringsAre(
validator.String(
stringvalidator.RegexMatches(regexp.MustCompile(util.SamAndUpnRegex), "must be in `DOMAIN\\UserName` or `user@domain.com` format"),
stringvalidator.RegexMatches(regexp.MustCompile(util.SamUpnSidRegex), "must be in SID, SAM account name (`DOMAIN\\UserName`) or UPN (`user@domain.com`) format"),
),
),
},
Expand Down
16 changes: 13 additions & 3 deletions internal/test/azure_mcs_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAzureMcsSuitePreCheck(t *testing.T) {
TestPolicySetResourcePreCheck(t)

if !isOnPremises {
TestAzureImageDefinitionResourcePreCheck(t)
TestAzureImageDefinitionResourcePreCheckForTestSuite(t)
TestMachineCatalogPreCheck_AzureAd(t)
TestMachineCatalogPreCheck_Workgroup(t)
} else {
Expand Down Expand Up @@ -210,7 +210,12 @@ func TestAzureMcs(t *testing.T) {

/*******************Image Definition Test******************/
{
Config: composeTestResourceTf(BuildAzureImageDefinitionTestResource(t)),
Config: composeTestResourceTf(
BuildHypervisorResourcePoolResourceAzure(t, hypervisor_resource_pool_updated_testResource_azure),
BuildHypervisorResourceAzure(t, hypervisor_testResources_updated),
BuildZoneResource(t, zoneInput, true),
BuildAzureImageDefinitionTestResourceForTestSuite(t),
),
Check: resource.ComposeAggregateTestCheckFunc(
// Verify the name of the image definition
resource.TestCheckResourceAttr("citrix_image_definition.test_azure_image_definition", "name", os.Getenv("TEST_IMAGE_DEFINITION_NAME")),
Expand All @@ -233,7 +238,12 @@ func TestAzureMcs(t *testing.T) {
},
// Update and Read testing
{
Config: composeTestResourceTf(BuildAzureImageDefinitionUpdatedTestResource(t)),
Config: composeTestResourceTf(
BuildHypervisorResourcePoolResourceAzure(t, hypervisor_resource_pool_updated_testResource_azure),
BuildHypervisorResourceAzure(t, hypervisor_testResources_updated),
BuildZoneResource(t, zoneInput, true),
BuildAzureImageDefinitionUpdatedTestResourceForTestSuite(t),
),
Check: resource.ComposeAggregateTestCheckFunc(
// Verify the name of the image definition
resource.TestCheckResourceAttr("citrix_image_definition.test_azure_image_definition", "name", os.Getenv("TEST_IMAGE_DEFINITION_NAME_UPDATED")),
Expand Down
61 changes: 51 additions & 10 deletions internal/test/image_definition_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ func TestAzureImageDefinitionResourcePreCheck(t *testing.T) {
checkTestEnvironmentVariables(t, azureImageDefinitionTestVariables)
}

func TestAzureImageDefinitionResourcePreCheckForTestSuite(t *testing.T) {
checkTestEnvironmentVariables(t, azureImageDefinitionTestVariablesForTestSuite)
}

func AzureImageDefinitionResourceHelper(t *testing.T, pre121 bool) {
var imageDefinitionResource string
var imageDefinitionResourceUpdated string
Expand Down Expand Up @@ -87,8 +91,20 @@ func BuildAzureImageDefinitionTestResource(t *testing.T) string {
imageDefinitionDescription := os.Getenv("TEST_IMAGE_DEFINITION_DESCRIPTION")
imageDefinitionOsType := os.Getenv("TEST_IMAGE_DEFINITION_OS_TYPE")
imageDefinitionSessionSupport := os.Getenv("TEST_IMAGE_DEFINITION_SESSION_SUPPORT")
imageDefinitionHypervisorId := os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_ID")
imageDefinitionHypervisorPoolId := os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_POOL_ID")
imageDefinitionHypervisorId := fmt.Sprintf(`"%s"`, os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_ID"))
imageDefinitionHypervisorPoolId := fmt.Sprintf(`"%s"`, os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_POOL_ID"))
imageDefinitionResourceGroup := os.Getenv("TEST_IMAGE_DEFINITION_RESOURCE_GROUP")

return fmt.Sprintf(azureImageDefinitionTestResource, imageDefinitionName, imageDefinitionDescription, imageDefinitionOsType, imageDefinitionSessionSupport, imageDefinitionHypervisorId, imageDefinitionHypervisorPoolId, imageDefinitionResourceGroup)
}

func BuildAzureImageDefinitionTestResourceForTestSuite(t *testing.T) string {
imageDefinitionName := os.Getenv("TEST_IMAGE_DEFINITION_NAME")
imageDefinitionDescription := os.Getenv("TEST_IMAGE_DEFINITION_DESCRIPTION")
imageDefinitionOsType := os.Getenv("TEST_IMAGE_DEFINITION_OS_TYPE")
imageDefinitionSessionSupport := os.Getenv("TEST_IMAGE_DEFINITION_SESSION_SUPPORT")
imageDefinitionHypervisorId := "citrix_azure_hypervisor.testHypervisor.id"
imageDefinitionHypervisorPoolId := "citrix_azure_hypervisor_resource_pool.testHypervisorResourcePool.id"
imageDefinitionResourceGroup := os.Getenv("TEST_IMAGE_DEFINITION_RESOURCE_GROUP")

return fmt.Sprintf(azureImageDefinitionTestResource, imageDefinitionName, imageDefinitionDescription, imageDefinitionOsType, imageDefinitionSessionSupport, imageDefinitionHypervisorId, imageDefinitionHypervisorPoolId, imageDefinitionResourceGroup)
Expand All @@ -99,8 +115,20 @@ func BuildAzureImageDefinitionUpdatedTestResource(t *testing.T) string {
imageDefinitionDescription := os.Getenv("TEST_IMAGE_DEFINITION_DESCRIPTION_UPDATED")
imageDefinitionOsType := os.Getenv("TEST_IMAGE_DEFINITION_OS_TYPE_UPDATED")
imageDefinitionSessionSupport := os.Getenv("TEST_IMAGE_DEFINITION_SESSION_SUPPORT_UPDATED")
imageDefinitionHypervisorId := os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_ID_UPDATED")
imageDefinitionHypervisorPoolId := os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_POOL_ID")
imageDefinitionHypervisorId := fmt.Sprintf(`"%s"`, os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_ID_UPDATED"))
imageDefinitionHypervisorPoolId := fmt.Sprintf(`"%s"`, os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_POOL_ID"))
imageDefinitionResourceGroup := os.Getenv("TEST_IMAGE_DEFINITION_RESOURCE_GROUP_UPDATED")

return fmt.Sprintf(azureImageDefinitionTestResource, imageDefinitionName, imageDefinitionDescription, imageDefinitionOsType, imageDefinitionSessionSupport, imageDefinitionHypervisorId, imageDefinitionHypervisorPoolId, imageDefinitionResourceGroup)
}

func BuildAzureImageDefinitionUpdatedTestResourceForTestSuite(t *testing.T) string {
imageDefinitionName := os.Getenv("TEST_IMAGE_DEFINITION_NAME_UPDATED")
imageDefinitionDescription := os.Getenv("TEST_IMAGE_DEFINITION_DESCRIPTION_UPDATED")
imageDefinitionOsType := os.Getenv("TEST_IMAGE_DEFINITION_OS_TYPE_UPDATED")
imageDefinitionSessionSupport := os.Getenv("TEST_IMAGE_DEFINITION_SESSION_SUPPORT_UPDATED")
imageDefinitionHypervisorId := "citrix_azure_hypervisor.testHypervisor.id"
imageDefinitionHypervisorPoolId := "citrix_azure_hypervisor_resource_pool.testHypervisorResourcePool.id"
imageDefinitionResourceGroup := os.Getenv("TEST_IMAGE_DEFINITION_RESOURCE_GROUP_UPDATED")

return fmt.Sprintf(azureImageDefinitionTestResource, imageDefinitionName, imageDefinitionDescription, imageDefinitionOsType, imageDefinitionSessionSupport, imageDefinitionHypervisorId, imageDefinitionHypervisorPoolId, imageDefinitionResourceGroup)
Expand All @@ -122,8 +150,8 @@ func BuildAzureImageDefinitionUpdatedTestResourcePre121(t *testing.T) string {
imageDefinitionDescription := os.Getenv("TEST_IMAGE_DEFINITION_DESCRIPTION_UPDATED")
imageDefinitionOsType := os.Getenv("TEST_IMAGE_DEFINITION_OS_TYPE_UPDATED")
imageDefinitionSessionSupport := os.Getenv("TEST_IMAGE_DEFINITION_SESSION_SUPPORT_UPDATED")
imageDefinitionHypervisorPoolId := os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_POOL_ID")
imageDefinitionHypervisorId := os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_ID_UPDATED")
imageDefinitionHypervisorPoolId := fmt.Sprintf(`"%s"`, os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_POOL_ID"))
imageDefinitionHypervisorId := fmt.Sprintf(`"%s"`, os.Getenv("TEST_IMAGE_DEFINITION_HYPERVISOR_ID_UPDATED"))

return fmt.Sprintf(azureImageDefinitionTestResourcePre121, imageDefinitionName, imageDefinitionDescription, imageDefinitionOsType, imageDefinitionSessionSupport, imageDefinitionHypervisorId, imageDefinitionHypervisorPoolId)
}
Expand Down Expand Up @@ -219,14 +247,27 @@ var (
"TEST_IMAGE_DEFINITION_RESOURCE_GROUP_UPDATED",
}

azureImageDefinitionTestVariablesForTestSuite = []string{
"TEST_IMAGE_DEFINITION_NAME",
"TEST_IMAGE_DEFINITION_NAME_UPDATED",
"TEST_IMAGE_DEFINITION_DESCRIPTION",
"TEST_IMAGE_DEFINITION_DESCRIPTION_UPDATED",
"TEST_IMAGE_DEFINITION_OS_TYPE",
"TEST_IMAGE_DEFINITION_OS_TYPE_UPDATED",
"TEST_IMAGE_DEFINITION_SESSION_SUPPORT",
"TEST_IMAGE_DEFINITION_SESSION_SUPPORT_UPDATED",
"TEST_IMAGE_DEFINITION_RESOURCE_GROUP",
"TEST_IMAGE_DEFINITION_RESOURCE_GROUP_UPDATED",
}

azureImageDefinitionTestResource = `
resource "citrix_image_definition" "test_azure_image_definition" {
name = "%s"
description = "%s"
os_type = "%s"
session_support = "%s"
hypervisor = "%s"
hypervisor_resource_pool = "%s"
hypervisor = %s
hypervisor_resource_pool = %s
azure_image_definition = {
resource_group = "%s"
use_image_gallery = false
Expand All @@ -240,8 +281,8 @@ resource "citrix_image_definition" "test_azure_image_definition" {
description = "%s"
os_type = "%s"
session_support = "%s"
hypervisor = "%s"
hypervisor_resource_pool = "%s"
hypervisor = %s
hypervisor_resource_pool = %s
}
`

Expand Down
3 changes: 3 additions & 0 deletions internal/test/machine_catalog_resource_pvs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ resource "citrix_machine_catalog" "testPvsMachineCatalog" {
}
}

delete_machine_accounts = "Delete"
zone = "%s"
}`

Expand Down Expand Up @@ -231,6 +232,7 @@ resource "citrix_machine_catalog" "testPvsMachineCatalog" {
}
}

delete_machine_accounts = "Delete"
zone = "%s"
}`

Expand Down Expand Up @@ -284,6 +286,7 @@ resource "citrix_machine_catalog" "testPvsMachineCatalog" {
}
}

delete_machine_accounts = "Delete"
zone = "%s"
}`

Expand Down
17 changes: 15 additions & 2 deletions internal/test/machine_catalog_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,8 @@ var (
naming_scheme_type ="Numeric"
}
}


delete_machine_accounts = "Delete"
zone = citrix_zone.test.id
}
`
Expand Down Expand Up @@ -1632,7 +1633,8 @@ var (
naming_scheme_type ="Numeric"
}
}


delete_machine_accounts = "Delete"
zone = citrix_zone.test.id
}
`
Expand Down Expand Up @@ -1686,6 +1688,7 @@ resource "citrix_machine_catalog" "testMachineCatalog%s" {
}
}

delete_machine_accounts = "Delete"
zone = citrix_zone.test.id
}
`
Expand Down Expand Up @@ -1740,6 +1743,8 @@ resource "citrix_machine_catalog" "testMachineCatalog%s" {
naming_scheme_type ="Numeric"
}
}

delete_machine_accounts = "Delete"
zone = citrix_zone.test.id
}
`
Expand Down Expand Up @@ -1794,6 +1799,8 @@ resource "citrix_machine_catalog" "testMachineCatalog%s" {
naming_scheme_type ="Numeric"
}
}

delete_machine_accounts = "Delete"
zone = citrix_zone.test.id
}
`
Expand Down Expand Up @@ -1846,6 +1853,7 @@ resource "citrix_machine_catalog" "testMachineCatalog%s" {
}
}

delete_machine_accounts = "Delete"
zone = citrix_zone.test.id
}
`
Expand Down Expand Up @@ -1898,6 +1906,8 @@ resource "citrix_machine_catalog" "testMachineCatalog%s" {
naming_scheme_type ="Numeric"
}
}

delete_machine_accounts = "Delete"
zone = citrix_zone.test.id
}
`
Expand Down Expand Up @@ -1941,6 +1951,7 @@ resource "citrix_machine_catalog" "testMachineCatalog%s" {
}
}

delete_machine_accounts = "Delete"
zone = citrix_zone.test.id
}
`
Expand Down Expand Up @@ -1983,6 +1994,8 @@ resource "citrix_machine_catalog" "testMachineCatalog%s" {
naming_scheme_type ="Numeric"
}
}

delete_machine_accounts = "Delete"
zone = citrix_zone.test.id
}
`
Expand Down
Loading
Loading