citrix / terraform-provider-citrix

Terraform Provider for Citrix
https://registry.terraform.io/providers/citrix/citrix/latest
Apache License 2.0
46 stars 6 forks source link

[Bug] citrix application cannot create 😒 #158

Open dimi4ik opened 5 days ago

dimi4ik commented 5 days ago

Describe the bug

Summary of the issue

With the new provider version, I am unable to create a Citrix application and receive the following message:


β”‚ The Terraform Provider unexpectedly returned no resource state after having no errors in the resource creation. This is always an issue in the Terraform Provider and should be reported to the provider developers.
β”‚ 
β”‚ The resource may have been successfully created, but Terraform is not tracking it. Applying the configuration again with no other action may result in duplicate resource errors. Import the resource if the resource was actually created and Terraform should be
β”‚ tracking it.

I have now manually created the application via the GUI and imported it with terraform import. After that, I can destroy the application, but unfortunately, I cannot create it again, as I receive the same message.

Terraform command (import, apply, etc): Resource impacted:

Versions

Use the terraform -v command to find the Terraform and Citrix Provider versions. Terraform: citrix/citrix provider: Operation system:

For on-premises customers fill out any that apply with the CU or LTSR version (eg 2402). CVAD (DDC, VDA, etc): Storefront:

Terraform configuration files

Paste or attach any relevant .tf files with secrets and identifying information removed.

# citrix_application.example-application:
resource "citrix_application" "example-application" {
  application_folder_path = "xxx"
  delivery_groups_priority = [
    {
      id       = "6919cebe-4151-40a8-8efd-9047694377a6"
      priority = 0
    },
  ]
  enabled = true
  icon    = "130"

  installed_app_properties = {
    command_line_executable = "C:\\Windows\\system32\\explorer.exe"
    working_directory       = "C:\\Windows\\system32"
  }
  limit_visibility_to_users = [
    "mxxx\\gg_r",
  ]
  name           = "explorer_tst"
  published_name = "explorer_tst"
}

Terraform console output

Paste the output from Terraform CLI including any errors and the transactionIds if present.

β”‚ The Terraform Provider unexpectedly returned no resource state after having no errors in the resource creation. This is always an issue in the Terraform Provider and should be reported to the provider developers. β”‚ β”‚ The resource may have been successfully created, but Terraform is not tracking it. Applying the configuration again with no other action may result in duplicate resource errors. Import the resource if the resource was actually created and Terraform should be β”‚ tracking it.

If the output references a file in the temp directory include it as well.

Terraform log file

If the issue is reproducible enable Terraform debug logging using one of the commands below. Then reproduce the issue and include the resulting log file. More information about Terraform logging is available here.

bash:

export TF_LOG="DEBUG"
export TF_LOG_PATH="./citrix-provider-issue.txt"
 terraform apply -auto-approve
2024-11-20T06:50:53.402+0100 [ERROR] provider.terraform-provider-citrix_v1.0.7: Response contains error diagnostic: @caller=github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov6/internal/diag/diagnostics.go:58 @module=sdk.proto tf_proto_version=6.7 tf_provider_addr=registry.terraform.io/citrix/citrix tf_req_id=4467b201-f0d4-2718-44bc-ee0bc7e9779c tf_rpc=ApplyResourceChange diagnostic_detail="The Terraform Provider unexpectedly returned no resource state after having no errors in the resource creation. This is always an issue in the Terraform Provider and should be reported to the provider developers.

The resource may have been successfully created, but Terraform is not tracking it. Applying the configuration again with no other action may result in duplicate resource errors. Import the resource if the resource was actually created and Terraform should be tracking it." diagnostic_severity=ERROR diagnostic_summary="Missing Resource State After Create" tf_resource_type=citrix_application timestamp=2024-11-20T06:50:53.402+0100
2024-11-20T06:50:53.406+0100 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-11-20T06:50:53.406+0100 [ERROR] vertex "citrix_application.example-application" error: Missing Resource State After Create
2024-11-20T06:50:53.410+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-11-20T06:50:53.412+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/citrix/citrix/1.0.7/linux_amd64/terraform-provider-citrix_v1.0.7 pid=20819
2024-11-20T06:50:53.412+0100 [DEBUG] provider: plugin exited

CitrixIssueId: 59315

yashbhokare-citrix commented 5 days ago

Hi @dimi4ik ,

Is this issue occurring only for this specific application, or are you experiencing similar problems with other applications as well? Could you also try creating the application again using only the essential parameters?

Regards, Yash Bhokare

dimi4ik commented 23 hours ago

@yashbhokare-citrix The issue occurs with every application, and the root cause seems to be the limit_visibility_to_users parameter. When I run it without this parameter, it works perfectly. Could I kindly ask you to test and fix this?

yashbhokare-citrix commented 9 hours ago

Hi @dimi4ik,

Thank you for trying it out. I was able to reproduce the same issue at my end by providing a user who does not exist.

Could you please try to create an application and then try to add the given user using the UI?

Regards, Yash Bhokare