cvbarros / terraform-provider-teamcity

Terraform Provider for Jetbrains TeamCity CI server
Mozilla Public License 2.0
79 stars 49 forks source link

Terraform crashes while attaching an existing Teamcity template #108

Open shagun05 opened 3 years ago

shagun05 commented 3 years ago

Hey!

Terraform version: 0.13.5 TeamCity Enterprise 2020.1 (build 78475)

I am trying to use the _teamcity_buildconfig resource with a pre-existing (Manually Created) Teamcity template as we are trying to port builds slowly over to terraform.
Teamcity side works fine and I get a new build associated with the template as expected. However, terraform crashes out while applying and taints the resource.


resource "teamcity_build_config" "solution_validation" {
  name        = "Solution Validation"
  project_id  =  "${teamcity_project.Cyara_Agent.id}"
  templates = ["GitSolutionValidationNetframeworkMonorepo"]
}

Error output through terraform:

teamcity_build_config.build: Creating...

Error: rpc error: code = Unavailable desc = transport is closing

Error: rpc error: code = Unavailable desc = transport is closing

panic: runtime error: invalid memory address or nil pointer dereference
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: [signal 0xc0000005 code=0x0 addr=0x28 pc=0xd825bd]
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: goroutine 159 [running]:
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: github.com/cvbarros/terraform-provider-teamcity/teamcity.flattenBuildStep(0x0, 0x0, 0xc000
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         github.com/cvbarros/terraform-provider-teamcity/teamcity/resource_build_config.go:
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: github.com/cvbarros/terraform-provider-teamcity/teamcity.resourceBuildConfigRead(0xc00016e
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         github.com/cvbarros/terraform-provider-teamcity/teamcity/resource_build_config.go:
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: github.com/cvbarros/terraform-provider-teamcity/teamcity.resourceBuildConfigUpdate(0xc0001
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         github.com/cvbarros/terraform-provider-teamcity/teamcity/resource_build_config.go:
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: github.com/cvbarros/terraform-provider-teamcity/teamcity.resourceBuildConfigCreate(0xc0001
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         github.com/cvbarros/terraform-provider-teamcity/teamcity/resource_build_config.go:
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000356cf0, 0x201, 0xc000228ad8, 0xc0002310b0)
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         github.com/hashicorp/terraform-plugin-sdk@v1.9.0/helper/schema/resource.go:310 +0x
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc000118900, 0xxc0001071f0, 0xe95e00)
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         github.com/hashicorp/terraform-plugin-sdk@v1.9.0/helper/schema/provider.go:294 +0x
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).App 0xc00016e930, 0xc000106548, 0xc000226d80, 0xc00000fb78)
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         github.com/hashicorp/terraform-plugin-sdk@v1.9.0/internal/helper/plugin/grpc_provi
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange0, 0xc00062e5a0, 0x0, 0x122f140, 0xc000226d80, 0xc0002a0000, 0x24a)
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         github.com/hashicorp/terraform-plugin-sdk@v1.9.0/internal/tfplugin5/tfplugin5.pb.g
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: google.golang.org/grpc.(*Server).processUnaryRPC(0xc00004f680, 0x1239800, 0xc00010c300, 0x
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         google.golang.org/grpc@v1.27.1/server.go:1024 +0x508
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: google.golang.org/grpc.(*Server).handleStream(0xc00004f680, 0x1239800, 0xc00010c300, 0xc00
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         google.golang.org/grpc@v1.27.1/server.go:1313 +0xd44
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000034060, 0xc00004f680, 0x123980
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         google.golang.org/grpc@v1.27.1/server.go:722 +0xa8
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-12-23T00:36:42.990Z [DEBUG] plugin.terraform-provider-teamcity_v1.0.1.exe:         google.golang.org/grpc@v1.27.1/server.go:720 +0xa8
2020/12/23 00:36:42 [DEBUG] teamcity_build_config.solution_validation: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error:
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalMaybeTainted
2020/12/23 00:36:42 [TRACE] EvalMaybeTainted: teamcity_build_config.solution_validation encountered an error during creation, so it is now marked as tainted
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalWriteState
2020/12/23 00:36:42 [TRACE] EvalWriteState: removing state object for teamcity_build_config.solution_validation
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalApplyProvisioners
2020/12/23 00:36:42 [TRACE] EvalApplyProvisioners: teamcity_build_config.solution_validation has no state, so skipping provisioners
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalMaybeTainted
2020/12/23 00:36:42 [TRACE] EvalMaybeTainted: teamcity_build_config.solution_validation encountered an error during creation, so it is now marked as tainted
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalWriteState
2020/12/23 00:36:42 [TRACE] EvalWriteState: removing state object for teamcity_build_config.solution_validation
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalIf
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalIf
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalWriteDiff
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalApplyPost
2020/12/23 00:36:42 [ERROR] eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/12/23 00:36:42 [ERROR] eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/12/23 00:36:42 [TRACE] [walkApply] Exiting eval tree: teamcity_build_config.solution_validation
2020/12/23 00:36:42 [TRACE] vertex "teamcity_build_config.solution_validation": visit complete
2020/12/23 00:36:42 [DEBUG] teamcity_build_config.build: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavai
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalMaybeTainted
2020/12/23 00:36:42 [TRACE] EvalMaybeTainted: teamcity_build_config.build encountered an error during creation, so it is now marked as tainted
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalWriteState
2020/12/23 00:36:42 [TRACE] EvalWriteState: removing state object for teamcity_build_config.build
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalApplyProvisioners
2020/12/23 00:36:42 [TRACE] EvalApplyProvisioners: teamcity_build_config.build has no state, so skipping provisioners
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalMaybeTainted
2020/12/23 00:36:42 [TRACE] EvalMaybeTainted: teamcity_build_config.build encountered an error during creation, so it is now marked as tainted
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalWriteState
2020/12/23 00:36:42 [TRACE] EvalWriteState: removing state object for teamcity_build_config.build
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalIf
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalIf
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalWriteDiff
2020/12/23 00:36:42 [TRACE] eval: *terraform.EvalApplyPost
2020/12/23 00:36:42 [ERROR] eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/12/23 00:36:42 [ERROR] eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/12/23 00:36:42 [TRACE] [walkApply] Exiting eval tree: teamcity_build_config.build
2020/12/23 00:36:42 [TRACE] vertex "teamcity_build_config.build": visit complete
2020/12/23 00:36:42 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/12/23 00:36:42 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/cvbarros/teamcity\"] (close)" errored, so skipping
2020/12/23 00:36:42 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/12/23 00:36:42 [TRACE] statemgr.Filesystem: have already backed up original terraform.tfstate to terraform.tfstate.backup on a previous write
2020/12/23 00:36:42 [TRACE] statemgr.Filesystem: state has changed since last snapshot, so incrementing serial to 8
2020/12/23 00:36:42 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2020/12/23 00:36:42 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/12/23 00:36:42 [TRACE] statemgr.Filesystem: unlocked by closing terraform.tfstate
2020-12-23T00:36:42.998Z [DEBUG] plugin: plugin process exited: path=.terraform/plugins/registry.terraform.io/cvbarros/teamcity/1.0.1/windows_amd64/terraform-provider-tear-teamcity_v1.0.1.exe pid=6636 error="exit status 2"
2020-12-23T00:36:42.998Z [DEBUG] plugin: plugin exited

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

SECURITY WARNING: the "crash.log" file that was created may contain
sensitive information that must be redacted before it is safe to share
on the issue tracker.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
raimonds-malisevs commented 3 years ago

Hello. Any updates on this?

cfullerton commented 2 years ago

@raimonds-malisevs see https://github.com/cvbarros/terraform-provider-teamcity/pull/117.