Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_stack_hci_cluster - change client_id to optional #25407

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func resourceArmStackHCICluster() *pluginsdk.Resource {

"client_id": {
Type: pluginsdk.TypeString,
Required: true,
Optional: true,
ForceNew: true,
ValidateFunc: validation.IsUUID,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ func TestAccStackHCICluster_basic(t *testing.T) {
})
}

func TestAccStackHCICluster_basicWithoutClientId(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_stack_hci_cluster", "test")
r := StackHCIClusterResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basicWithoutClientId(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("cloud_id").IsNotEmpty(),
check.That(data.ResourceName).Key("service_endpoint").IsNotEmpty(),
check.That(data.ResourceName).Key("resource_provider_object_id").IsNotEmpty(),
),
},
data.ImportStep(),
})
}

func TestAccStackHCICluster_requiresImport(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_stack_hci_cluster", "test")
r := StackHCIClusterResource{}
Expand Down Expand Up @@ -178,6 +196,20 @@ func (r StackHCIClusterResource) Exists(ctx context.Context, client *clients.Cli
return utils.Bool(resp.Model != nil), nil
}

func (r StackHCIClusterResource) basicWithoutClientId(data acceptance.TestData) string {
template := r.template(data)
return fmt.Sprintf(`
%s

resource "azurerm_stack_hci_cluster" "test" {
name = "acctest-StackHCICluster-%d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
tenant_id = data.azurerm_client_config.current.tenant_id
}
`, template, data.RandomInteger)
}

func (r StackHCIClusterResource) basic(data acceptance.TestData) string {
template := r.template(data)
return fmt.Sprintf(`
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/stack_hci_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The following arguments are supported:

* `location` - (Required) The Azure Region where the Azure Stack HCI Cluster should exist. Changing this forces a new resource to be created.

* `client_id` - (Required) The Client ID of the Azure Active Directory which is used by the Azure Stack HCI Cluster. Changing this forces a new resource to be created.
* `client_id` - (Optional) The Client ID of the Azure Active Directory which is used by the Azure Stack HCI Cluster. Changing this forces a new resource to be created.
manicminer marked this conversation as resolved.
Show resolved Hide resolved

* `identity` - (Optional) An `identity` block as defined below.

Expand Down
Loading