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

Unable to remove dnacenter_configuration_template_version resource #216

Closed
3 tasks done
mschedrin opened this issue Sep 29, 2023 · 6 comments
Closed
3 tasks done
Assignees

Comments

@mschedrin
Copy link

mschedrin commented Sep 29, 2023

Prerequisites

  • Have you tested the operation in the API directly?
  • Do you have the latest Terraform provider version?
  • Review the compatibility matrix before opening an issue.

Describe the bug
First of all, apologize opening new bug, this issue is related to #212 which I cannot reopen.
Provider does not allow to remove the resource any more. This has 2 negative consequences for provider users:

  1. Terraform destroy does not work and always fails:
dnacenter_configuration_template_version.this: Destroying... [id=template_id:=3e02dfb5-d67d-4f49-a331-79fdcdc401a9]
│ Error: Failure when executing ConfigurationTemplateVersionDelete
│ 
│ Delete not possible in this resource
│ Delete method is not supported
  1. dnacenter_configuration_template_version is used in conjunction with dnacenter_configuration_template. Typical workflow is to create configuration template and then commit it with dnacenter_configuration_template_version, this resource does not create any resource in DNAC, it just makes one time action to commit a new version of the template. This works fine upon template creation, however when we change dnacenter_configuration_template we need to commit new version to DNAC. I have been using replace_triggered_by in dnacenter_configuration_template_version in order to trigger resource recreation upon update of configuration template. This approach does not work any more as delete method has been removed from the resource. Please advice how to commit changes to configuration template without being able to delete dnacenter_configuration_template_version resource. Maybe @zapodeanu can suggest what could be viable workflow to commit changes to a template?
resource "dnacente r_configuration_template_version" "this" {
  depends_on = [ dnacenter_configuration_template.this ]
  lifecycle { 
    replace_triggered_by = [dnacenter_configuration_template.this]
  }

  parameters {
    template_id = dnacenter_configuration_template.this["logging"].item[0].id
  }
}

Environment (please complete the following information):

  • Cisco DNA Center version and patch: 2.3.5.4-70852
  • Terraform version: 1.5.6
  • Cisco DNA Center provider version: 1.1.18-beta
  • OS Version: Ubuntu 20.04
fmunozmiranda pushed a commit that referenced this issue Oct 3, 2023
…216 - `dnacenter_configuration_template_version` is an action resource
@fmunozmiranda
Copy link
Collaborator

Hi, @mschedrin, dnacenter_configuration_template_version change to achieve this behavior, please see docs:

https://registry.terraform.io/providers/cisco-en-programmability/dnacenter/latest/docs/resources/configuration_template_version

Let us know if it works for you.

@mschedrin
Copy link
Author

I cannot test your suggestion @fmunozmiranda, latest provider version(1.1.21) crashes when I create template resource.

dnacenter_configuration_template_project.dayN: Creating...
dnacenter_configuration_template_project.dayN: Creation complete after 5s [id=name:=DayN Templates]
data.dnacenter_configuration_template_project.all: Reading...
data.dnacenter_configuration_template_project.all: Read complete after 0s [id=1696861037]
dnacenter_configuration_template.this["logging"]: Creating...
╷
│ Error: Plugin did not respond
│ 
│   with dnacenter_configuration_template.this["logging"],
│   on main.tf line 36, in resource "dnacenter_configuration_template" "this":
│   36: resource "dnacenter_configuration_template" "this" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Request cancelled
│ 
│   with dnacenter_configuration_template.this["Onboarding Border"],
│   on main.tf line 36, in resource "dnacenter_configuration_template" "this":
│   36: resource "dnacenter_configuration_template" "this" {
│ 
│ The plugin.(*GRPCProvider).ValidateResourceConfig request was cancelled.
╵

Stack trace from the terraform-provider-dnacenter_v1.1.21 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe8706c]

goroutine 74 [running]:
terraform-provider-dnacenter/dnacenter.resourceConfigurationTemplateCreate({0x1813688, 0xc001364660}, 0x0?, {0x1424f80?, 0xc000370b00?})
        terraform-provider-dnacenter/dnacenter/resource_configuration_template.go:2265 +0x9ec
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0000f4e00, {0x18136c0, 0xc00103e570}, 0xd?, {0x1424f80, 0xc000370b00})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:733 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0000f4e00, {0x18136c0, 0xc00103e570}, 0xc000553ba0, 0xc0014f6e80, {0x1424f80, 0xc000370b00})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:864 +0xa85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000124078, {0x18136c0?, 0xc00103e450?}, 0xc000da2b40)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/grpc_provider.go:1024 +0xe3c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00012c0a0, {0x18136c0?, 0xc000da5bf0?}, 0xc0014289a0)
        github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov5/tf5server/server.go:821 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x14f9d20?, 0xc00012c0a0}, {0x18136c0, 0xc000da5bf0}, 0xc001428930, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:422 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00038a000, {0x18163e0, 0xc000558680}, 0xc000db05a0, 0xc000a78930, 0x1efb520, 0x0)
        google.golang.org/grpc@v1.57.0/server.go:1360 +0xe13
google.golang.org/grpc.(*Server).handleStream(0xc00038a000, {0x18163e0, 0xc000558680}, 0xc000db05a0, 0x0)
        google.golang.org/grpc@v1.57.0/server.go:1737 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.57.0/server.go:982 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.57.0/server.go:980 +0x18c

Error: The terraform-provider-dnacenter_v1.1.21 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

fmunozmiranda pushed a commit that referenced this issue Oct 11, 2023
BUGFIXES:
* Provider does not detect changes in resource dnacenter_configuration_template made outside of terraform #211 - possible nil answer exeption managed. Now is possible to test #216.
* Pagination support when interacting with API #215 - removing sleep, code 429 is managed by go-sdk.
@fmunozmiranda
Copy link
Collaborator

Hi @mschedrin with 1.1.22-beta you should be able to test it.

@mschedrin
Copy link
Author

The resource works correct now from terraform point of view, however I can't see results in DNAC, even though API requests sent by the provider are correct. I suspect that I am hitting now an issue with DNAC API. Let me investigate it further. Please let me keep the issue open while I am working with it so that I can update it.

@mschedrin
Copy link
Author

Just an update: Cisco Technical Support is working with reproducing the issue in their environment.

@mschedrin
Copy link
Author

The issue is confirmed in DNAC and will be fixed.

bvargasre pushed a commit that referenced this issue Jun 21, 2024
…216 - `dnacenter_configuration_template_version` is an action resource
bvargasre pushed a commit that referenced this issue Jun 21, 2024
BUGFIXES:
* Provider does not detect changes in resource dnacenter_configuration_template made outside of terraform #211 - possible nil answer exeption managed. Now is possible to test #216.
* Pagination support when interacting with API #215 - removing sleep, code 429 is managed by go-sdk.
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

No branches or pull requests

3 participants