microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
387 stars 276 forks source link

Crash when trying to create a git repository #146

Closed sdebruyn closed 4 years ago

sdebruyn commented 4 years ago

Community Note

Terraform (and Azure DevOps Provider) Version

➜ tf -v
Terraform v0.13.0
+ provider registry.terraform.io/terraform-providers/azuredevops v0.0.1

Affected Resource(s)

Terraform Configuration Files

resource "azuredevops_git_repository" "repo" {
  name       = "dl-dev-dummy"
  project_id = var.project_id
}

Debug Output

azuredevops_git_repository.repo: Creating...

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

panic: runtime error: invalid memory address or nil pointer dereference
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x19f4b74]
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: goroutine 62 [running]:
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/terraform-providers/terraform-provider-azuredevops/azuredevops/internal/service/git.resourceGitRepositoryCreate(0xc00011cc40, 0x1ae7520, 0xc00039c300, 0x2, 0x2734300)
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/azuredevops/internal/service/git/resource_git_repository.go:173 +0x444
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000117d80, 0xc0000caaa0, 0xc000262540, 0x1ae7520, 0xc00039c300, 0x1b8f801, 0xc0003e72c8, 0xc00007d500)
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go:305 +0x365
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc000570800, 0xc0002d18e0, 0xc0000caaa0, 0xc000262540, 0xc0009b6bc8, 0xc00000e038, 0x1b918a0)
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:294 +0x99
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc0000b0b20, 0x1f7c840, 0xc00007c360, 0xc0002bc0c0, 0xc0000b0b20, 0xc00007c360, 0xc0009c3a48)
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:885 +0x8b4
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1cc1b80, 0xc0000b0b20, 0x1f7c840, 0xc00007c360, 0xc0002bc060, 0x0, 0x1f7c840, 0xc00007c360, 0xc0009b4000, 0x1bd)
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3189 +0x217
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000e2000, 0x1f89dc0, 0xc000882900, 0xc0009b2000, 0xc00060c390, 0x26fa2c0, 0x0, 0x0, 0x0)
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/vendor/google.golang.org/grpc/server.go:995 +0x460
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: google.golang.org/grpc.(*Server).handleStream(0xc0000e2000, 0x1f89dc0, 0xc000882900, 0xc0009b2000, 0x0)
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/vendor/google.golang.org/grpc/server.go:1275 +0xd3d
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0000b6430, 0xc0000e2000, 0x1f89dc0, 0xc000882900, 0xc0009b2000)
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/vendor/google.golang.org/grpc/server.go:710 +0xa1
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-08-12T15:47:12.591+0200 [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azuredevops/vendor/google.golang.org/grpc/server.go:708 +0xa1
2020/08/12 15:47:12 [DEBUG] azuredevops_git_repository.repo: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2020/08/12 15:47:12 [TRACE] eval: *terraform.EvalMaybeTainted
2020/08/12 15:47:12 [TRACE] EvalMaybeTainted: azuredevops_git_repository.repo encountered an error during creation, so it is now marked as tainted
2020/08/12 15:47:12 [TRACE] eval: *terraform.EvalWriteState
2020/08/12 15:47:12 [TRACE] EvalWriteState: removing state object for azuredevops_git_repository.repo
2020/08/12 15:47:12 [TRACE] eval: *terraform.EvalApplyProvisioners
2020/08/12 15:47:12 [TRACE] EvalApplyProvisioners: azuredevops_git_repository.repo has no state, so skipping provisioners
2020/08/12 15:47:12 [TRACE] eval: *terraform.EvalMaybeTainted
2020/08/12 15:47:12 [TRACE] EvalMaybeTainted: azuredevops_git_repository.repo encountered an error during creation, so it is now marked as tainted
2020/08/12 15:47:12 [TRACE] eval: *terraform.EvalWriteState
2020/08/12 15:47:12 [TRACE] EvalWriteState: removing state object for azuredevops_git_repository.repo
2020/08/12 15:47:12 [TRACE] eval: *terraform.EvalIf
2020/08/12 15:47:12 [TRACE] eval: *terraform.EvalIf
2020/08/12 15:47:12 [TRACE] eval: *terraform.EvalWriteDiff
2020/08/12 15:47:12 [TRACE] eval: *terraform.EvalApplyPost
2020-08-12T15:47:12.593+0200 [DEBUG] plugin: plugin process exited: path=.terraform/plugins/registry.terraform.io/terraform-providers/azuredevops/0.0.1/darwin_amd64/terraform-provider-azuredevops_v0.0.1_x4 pid=3929 error="exit status 2"
2020/08/12 15:47:12 [ERROR] eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/08/12 15:47:12 [ERROR] eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/08/12 15:47:12 [TRACE] [walkApply] Exiting eval tree: azuredevops_git_repository.repo
2020/08/12 15:47:12 [TRACE] vertex "azuredevops_git_repository.repo": visit complete
2020/08/12 15:47:12 [TRACE] dag/walk: upstream of "output.repo_git_url (expand)" errored, so skipping
2020/08/12 15:47:12 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/08/12 15:47:12 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/terraform-providers/azuredevops\"] (close)" errored, so skipping
2020/08/12 15:47:12 [TRACE] dag/walk: upstream of "provisioner.local-exec (close)" errored, so skipping
2020/08/12 15:47:12 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020-08-12T15:47:12.783+0200 [DEBUG] plugin: plugin exited
2020-08-12T15:47:12.784+0200 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2020-08-12T15:47:12.786+0200 [DEBUG] plugin: plugin process exited: path=/usr/local/bin/terraform pid=3921
2020-08-12T15:47:12.786+0200 [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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Panic Output

https://gist.github.com/sdebruyn/8b927e4ff2e8494b7856bc15f65ecf5a

Expected Behavior

Repository should have been created.

Actual Behavior

Crash

Steps to Reproduce

  1. terraform plan -out plan
  2. terraform apply plan
sdebruyn commented 4 years ago

So the code that this is pointing to, has changed a bit since merging #118 But the new code has a similar nil check error, PR incoming

xuzhang3 commented 4 years ago

Hi @sdebruyn Thanks for opening this issue. This is a bug of v0.0.1. The initialization is marked with Optional but nil is not checked. The initialization configuration has been changed from Optional to Required. initialization Required