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

[BUG] Unable to remove citrixadc_policystringmap_pattern_binding with / or special char #1018

Closed
RafaelloLollipop opened this issue Mar 14, 2023 · 4 comments

Comments

@RafaelloLollipop
Copy link

RafaelloLollipop commented Mar 14, 2023

Bug Report

Describe the bug

If key in string map contains "/'" or "%" it can not be removed by terraform.
But i'm pretty sure that it was working like 1-2 months ago.

To Reproduce
Steps to reproduce the behaviour:

  1. My terraform files are
resource "citrixadc_policystringmap" "tf_policystringmap" {
  name    = "tf_tests"
}


resource "citrixadc_policystringmap_pattern_binding" "tf_bind1" {
  name  = "tf_tests"
  key   = "test"
  value = "test"
}


resource "citrixadc_policystringmap_pattern_binding" "tf_bind2" {
  name  = "tf_tests"
  key   = "test/test"
  value = "random"
}

Plan:

-------------------------------------------------------------------------
string_maps: Perform terraform plan
-------------------------------------------------------------------------

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.ns_tst_string_maps.citrixadc_policystringmap.tf_policystringmap will be created
  + resource "citrixadc_policystringmap" "tf_policystringmap" {
      + comment = (known after apply)
      + id      = (known after apply)
      + name    = "tf_tests"
    }

  # module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind1 will be created
  + resource "citrixadc_policystringmap_pattern_binding" "tf_bind1" {
      + id    = (known after apply)
      + key   = "test"
      + name  = "tf_tests"
      + value = "test"
    }

  # module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind2 will be created
  + resource "citrixadc_policystringmap_pattern_binding" "tf_bind2" {
      + id    = (known after apply)
      + key   = "test/test"
      + name  = "tf_tests"
      + value = "random"
    }

Plan: 3 to add, 0 to change, 0 to destroy.

After apply:

image

Removing bindings:

resource "citrixadc_policystringmap" "tf_policystringmap" {
  name    = "tf_tests"
}

plan:

string_maps: Perform terraform plan
-------------------------------------------------------------------------
module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind1: Refreshing state... [id=tf_tests,test]
module.ns_tst_string_maps.citrixadc_policystringmap.tf_policystringmap: Refreshing state... [id=tf_tests]
module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind2: Refreshing state... [id=tf_tests,test/test]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind1 will be destroyed
  # (because citrixadc_policystringmap_pattern_binding.tf_bind1 is not in configuration)
  - resource "citrixadc_policystringmap_pattern_binding" "tf_bind1" {
      - id    = "tf_tests,test" -> null
      - key   = "test" -> null
      - name  = "tf_tests" -> null
      - value = "test" -> null
    }

  # module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind2 will be destroyed
  # (because citrixadc_policystringmap_pattern_binding.tf_bind2 is not in configuration)
  - resource "citrixadc_policystringmap_pattern_binding" "tf_bind2" {
      - id    = "tf_tests,test/test" -> null
      - key   = "test/test" -> null
      - name  = "tf_tests" -> null
      - value = "random" -> null
    }

Plan: 0 to add, 0 to change, 2 to destroy.


apply:

-------------------------------------------------------------------------
string_maps: Perform terraform apply
-------------------------------------------------------------------------
module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind2: Destroying... [id=tf_tests,test/test]
module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind1: Destroying... [id=tf_tests,test]
module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind2: Destruction complete after 0s
module.ns_tst_string_maps.citrixadc_policystringmap_pattern_binding.tf_bind1: Destruction complete after 0s

Apply complete! Resources: 0 added, 0 changed, 2 destroyed.

State:

image

Expected behaviour
Both citrixadc_policystringmap_pattern_binding. removed

Environment (please complete the following information):

  • ubuntu
Terraform v1.1.4
on linux_amd64
+ provider registry.terraform.io/citrix/citrixadc v1.32.0    ( I checked also on v1.8.0)
+ provider registry.terraform.io/hashicorp/aws v3.76.1
+ provider registry.terraform.io/hashicorp/http v2.1.0
+ provider registry.terraform.io/hashicorp/local v2.1.0

go version go1.18 linux/amd64

Additional context

@ravager-dk
Copy link
Contributor

ravager-dk commented Apr 4, 2023

This issue is caused by the AddResource function in the client escaping special characters, while the DeleteResourceWithArgs does not.

netscaler/adc-nitro-go#66

@rohit-myali
Copy link
Contributor

Hello @RafaelloLollipop ,
Thanks for raising this issue. I did fix this issue and it will be released to the terraform registry in our next releases. I will update you on that soon.

Hey @ravager-dk , thanks for working on this issue, I saw your PR but currently we are not accepting 3rd party contribution due to some company policies. Our internal team is working on accepting 3rd part contribution we will update this soon.

Thanks,
Rohit

@ravager-dk
Copy link
Contributor

Hello @RafaelloLollipop ,
Thanks for raising this issue. I did fix this issue and it will be released to the terraform registry in our next releases. I will update you on that soon.

Hey @ravager-dk , thanks for working on this issue, I saw your PR but currently we are not accepting 3rd party contribution due to some company policies. Our internal team is working on accepting 3rd part contribution we will update this soon.

Thanks,
Rohit

Hi Rohit

No problem, I am actually internal, just not in engineering.

Regards,
Martin Nygaard Jensen

@rohit-myali
Copy link
Contributor

Hi @RafaelloLollipop ,
Thanks for raising this issue.
I have fixed the resource you can use the latest terraform plugin v1.34.0.

Thanks
Rohit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants