Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

cdktf-provider-vault: Go Pkg Seems to be unusable - duplicate method #2907

@Mercanuis

Description

@Mercanuis

Expected Behavior

Currently, am trying to learn and try to use the Vault Provider's Golang package for experimentation and prototyping of a new service I'm trying to build.

I was hoping to be able to use the provider and run code to try and generate a working package that can compile and be built

Actual Behavior

My team uses Bazel, to handle a central go.mod for all projects across the monorepo. The main use of it is to handle the dependency packages for all golang packages being used

We run the go mod tidy as a process to make sure the mod is updated and clean and I see this message stemming from go mod when pulling in the package dep per the documentation

INFO: Running command line: bazel-bin/go_mod_tidy
go: finding module for package github.com/cdktf/cdktf-provider-vault-go/vault
go: found github.com/cdktf/cdktf-provider-vault-go/vault in github.com/cdktf/cdktf-provider-vault-go/vault v1.0.2
go: github.com/org/project/subprojectdir/xxx/xxx-vault/cmd imports
	github.com/cdktf/cdktf-provider-vault-go/vault: github.com/cdktf/cdktf-provider-vault-go/[email protected]: parsing go.mod:
	module declares its path as: github.com/hashicorp/cdktf-provider-vault-go/vault
	        but was required as: github.com/cdktf/cdktf-provider-vault-go/vault

My first thought it to replace this with the declared path and change my mod. go mod works and everything looks okay but then I got this error when attempting to build the project with the dependencies pulled in

 ~/Workspaces/xxx/ bazel build //subprojectdir/xxx/xxx-vault/cmd:cmd
INFO: Analyzed target //ns/bote/bote-vault/cmd:cmd (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_xxx/7d39ed14ed4635a76aa230719a8d0c9e/external/com_github_hashicorp_cdktf_provider_vault_go_vault/BUILD.bazel:3:11: GoCompilePkg external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.a failed: (Exit 1): builder failed: error executing command (from target @com_github_hashicorp_cdktf_provider_vault_go_vault//:vault) bazel-out/darwin_arm64-opt-exec-2B5CBBC6-ST-e846b08c7501/bin/external/go_sdk/builder_reset/builder compilepkg -sdk external/go_sdk -installsuffix darwin_arm64 -src ... (remaining 33 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:15:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:45:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:15:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:47:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2119:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2128:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2119:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2130:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2976:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2985:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2976:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2987:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:3765:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:3777:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:3765:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:3779:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4893:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4904:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4893:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4906:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4893:2: too many errors
compilepkg: error running subcommand external/go_sdk/pkg/tool/darwin_arm64/compile: exit status 2
Target //subprojectdir/xxx/xxx-vault/cmd:cmd failed to build

Steps to Reproduce

  1. Using the provided Gist run go mod tidy
  2. Run go build or if using bazel , can run the target that builds a go_library
  3. The output should be as above

Versions

 ~/Workspaces/xxx/ cdktf debug
cdktf debug
language: null
cdktf-cli: 0.16.1
node: v18.16.0
terraform: 1.4.6
arch: arm64
os: darwin 22.5.0

Providers

 ~/Workspaces/xxx/ cdktf provider list
Error
    at Object.External (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:94:41818)
    at np.read (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:153:2419)
    at Object.Qxr (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:498:32892)
    at Tp.handleCommand (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cdktf.js:54:895)
    at N.handler (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cdktf.js:53:30050)
    at /opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:8993
    at j (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:4956)
    at _.handleValidationAndGetResult (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:8962)
    at _.applyMiddlewareAndGetResult (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:9604)
    at _.runCommand (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:7231)
Collecting Debug Information...
/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error
    at Object.External (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:94:41818)
    at np.read (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:153:2419)
    at Object.Qxr (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:498:32892)
    at Tp.handleCommand (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cdktf.js:54:895)
    at N.handler (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cdktf.js:53:30050)
    at /opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:8993
    at j (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:4956)
    at _.handleValidationAndGetResult (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:8962)
    at _.applyMiddlewareAndGetResult (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:9604)
    at _.runCommand (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:7231) {
  __type: 'External'
}

Node.js v18.16.0

Gist

https://gist.github.com/Mercanuis/c98fafbd270b6e1bab0bf35cc8fd8507

Workarounds

None yet, conversely trying to use the listed package on the documentation results in the following output stated above

Anything Else?

Bazel might be one possible factor. However, the way its set up in our project is simply using the golang toolchain's version of go mod go build etc.

 ~/Workspaces/xxx/ go version  
go version go1.20.4 darwin/arm64

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglanguage/golangpre-built providersIssues around pre-built providers managed at https://github.com/hashicorp/cdktf-repository-managerpriority/important-soonHigh priority, to be worked on as part of our current release or the following one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions