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

Secret managers connectors created in terraform cannot be used by secrets #1025

Open
yasirmohamed777 opened this issue Jul 30, 2024 · 0 comments

Comments

@yasirmohamed777
Copy link

Terraform Version

v1.5.0

Harness Provider Version

0.32.2

Affected Resource(s)

  • harness_platform_connector_custom_secret_manager
  • harness_platform_secret_text

Terraform Configuration Files

resource "harness_platform_secret_text" "secret" {
  org_id                    = var.org_id
  project_id                = var.project_id
  identifier                = "secret"
  name                      = "secretr"
  description               = "secret"
  secret_manager_identifier = harness_platform_connector_custom_secret_manager.custom_secret_manager.identifier
  value_type                = "CustomSecretManagerValues"
  value                     = null

  lifecycle {
    ignore_changes = [value]
  }
}

resource "harness_platform_connector_custom_secret_manager" "custom_secret_manager" {
  org_id                    = var.org_id
  project_id                = var.project_id
  description        = "Manager"
  name               = "manager"
  identifier         = "manager"
  type               = "CustomSecretManager"
  template_ref       = "sometemplate"
  version_label      = "v1"
  on_delegate        = true
  timeout            = 20
  delegate_selectors = ["name of the delegate"]
}

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

╷
│ Error: POST https: //app.harness.io/gateway/ng/api/v2/secrets?accountIdentifier=<REDACTED>&orgIdentifier=<REDACTED>&projectIdentifier=<REDACTED> giving up after 11 attempt(s)
│ 
│   with harness_platform_secret_text.<REDACTED>[
  0
],
│   on harness.tf line 128, in resource "harness_platform_secret_text""<REDACTED>":
│  128: resource "harness_platform_secret_text""<REDACTED>"{
│ 

Expected Behavior

What should have happened?
The secret get created

Actual Behavior

The secret does not get created and the apply errors out

###Important Note
While troubleshooting I noticed that when the secret manager is created from terraform the templateinputs are set to null; however when it is created from the web UI the templateinputs are set to {}. When you try to set the template_inputs to template_inputs {} in terraform, you will get a panic error

Stack trace from the terraform-provider-harness_v0.32.2 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 28 [running]:
github.com/harness/terraform-provider-harness/internal/service/platform/connector.buildConnectorCustomSM(0xc000b60d18?)
	github.com/harness/terraform-provider-harness/internal/service/platform/connector/custom_secret_manager.go:227 +0xa87
github.com/harness/terraform-provider-harness/internal/service/platform/connector.resourceConnectorCustomSMCreateOrUpdate({0x1a64608, 0xc00076a360}, 0x0?, {0x14e22a0, 0xc000187c20})
	github.com/harness/terraform-provider-harness/internal/service/platform/connector/custom_secret_manager.go:176 +0x39
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0007d0ee0, {0x1a64640, 0xc000b474d0}, 0xd?, {0x14e22a0, 0xc000187c20})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:733 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0007d0ee0, {0x1a64640, 0xc000b474d0}, 0xc0004f72b0, 0xc000126980, {0x14e22a0, 0xc000187c20})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:864 +0xa85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000568060, {0x1a64640?, 0xc000b473b0?}, 0xc000536190)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1024 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00040e960, {0x1a64640?, 0xc000b469c0?}, 0xc000590000)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:821 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x159e2a0?, 0xc00040e960}, {0x1a64640, 0xc000b469c0}, 0xc000126080, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:422 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0004ce200, {0x1a64640, 0xc000b46930}, {0x1a687a0, 0xc00072e1a0}, 0xc0008f0120, 0xc0007b0ed0, 0x2261e60, 0x0)
	google.golang.org/[email protected]/server.go:1385 +0xe75
google.golang.org/grpc.(*Server).handleStream(0xc0004ce200, {0x1a687a0, 0xc00072e1a0}, 0xc0008f0120)
	google.golang.org/[email protected]/server.go:1796 +0xd51
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1029 +0x91
created by google.golang.org/grpc.(*Server).serveStreams.func2
	google.golang.org/[email protected]/server.go:1040 +0x145

Error: The terraform-provider-harness_v0.32.2 plugin crashed!
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

1 participant