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

Terraform crash if initialization not set for git repo #54

Closed
EliiseS opened this issue Jul 3, 2020 · 2 comments
Closed

Terraform crash if initialization not set for git repo #54

EliiseS opened this issue Jul 3, 2020 · 2 comments

Comments

@EliiseS
Copy link
Member

EliiseS commented Jul 3, 2020

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 "me too" comments, 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

Description

Crashes with invalid terraform instead of returning an error.

Valid git_repo:

resource "azuredevops_git_repository" "repo" {
  project_id = azuredevops_project.test.id
  name       = "test-repo"
  initialization {
    init_type = "Clean"
  }
}

Invalid git_repo:

resource "azuredevops_git_repository" "repo" {
  project_id = azuredevops_project.test.id
  name       = "test-repo"
}

Terraform (and Azure DevOps Provider) Version

10:55 # terraform -v
Terraform v0.12.28
+ provider.azuredevops v0.0.1

Affected Resource(s)

  • azuredevops_git_repository

Terraform Configuration Files

provider "azuredevops" {
  version = ">= 0.0.1"
}

resource "azuredevops_project" "test" {
  project_name = "Test Project"
}

resource "azuredevops_git_repository" "repo" {
  project_id = azuredevops_project.test.id
  name       = "test-repo"
}

resource "azuredevops_git_repository" "fork-repo" {
  project_id           = azuredevops_project.test.id
  name                 = "forkk-test-repo"
  parent_repository_id = azuredevops_git_repository.repo.id
}

Panic Output

10:55 # tf apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azuredevops_git_repository.fork-repo will be created
  + resource "azuredevops_git_repository" "fork-repo" {
      + default_branch       = (known after apply)
      + id                   = (known after apply)
      + is_fork              = (known after apply)
      + name                 = "forkk-test-repo"
      + parent_repository_id = (known after apply)
      + project_id           = (known after apply)
      + remote_url           = (known after apply)
      + size                 = (known after apply)
      + ssh_url              = (known after apply)
      + url                  = (known after apply)
      + web_url              = (known after apply)
    }

  # azuredevops_git_repository.repo will be created
  + resource "azuredevops_git_repository" "repo" {
      + default_branch = (known after apply)
      + id             = (known after apply)
      + is_fork        = (known after apply)
      + name           = "test-repo"
      + project_id     = (known after apply)
      + remote_url     = (known after apply)
      + size           = (known after apply)
      + ssh_url        = (known after apply)
      + url            = (known after apply)
      + web_url        = (known after apply)
    }

  # azuredevops_project.test will be created
  + resource "azuredevops_project" "test" {
      + id                  = (known after apply)
      + process_template_id = (known after apply)
      + project_name        = "Test Project"
      + version_control     = "git"
      + visibility          = "private"
      + work_item_template  = "Agile"
    }

Plan: 3 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

azuredevops_project.test: Creating...
azuredevops_project.test: Creation complete after 9s [id=4d72f0bf-5fdf-4b32-b674-7bf7b30a2ab3]
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-07-17T10:55:27.300Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xdf6554]
2020-07-17T10:55:27.300Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: 
2020-07-17T10:55:27.300Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: goroutine 56 [running]:
2020-07-17T10:55:27.300Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/terraform-providers/terraform-provider-azuredevops/azuredevops/internal/service/git.resourceGitRepositoryCreate(0xc0001c4d90, 0xee91e0, 0xc000312240, 0x2, 0x1b328a0)
2020-07-17T10:55:27.300Z [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-07-17T10:55:27.300Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc00018dd00, 0xc000512d70, 0xc000421720, 0xee91e0, 0xc000312240, 0xf90f01, 0xc0000a1608, 0xc0005bc600)
2020-07-17T10:55:27.301Z [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-07-17T10:55:27.301Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc0004f6780, 0xc0002678e0, 0xc000512d70, 0xc000421720, 0xc0001322c8, 0xc00000e850, 0xf92fa0)
2020-07-17T10:55:27.301Z [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-07-17T10:55:27.301Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00000e5d0, 0x137d860, 0xc0006710e0, 0xc000672660, 0xc00000e5d0, 0xc0006710e0, 0xc000296a48)
2020-07-17T10:55:27.301Z [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-07-17T10:55:27.301Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x10c2d20, 0xc00000e5d0, 0x137d860, 0xc0006710e0, 0xc000672600, 0x0, 0x137d860, 0xc0006710e0, 0xc000744380, 0x1af)
2020-07-17T10:55:27.301Z [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-07-17T10:55:27.301Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003e6000, 0x138ab80, 0xc0004d6780, 0xc00018e500, 0xc0001810e0, 0x1af8200, 0x0, 0x0, 0x0)
2020-07-17T10:55:27.301Z [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-07-17T10:55:27.301Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: google.golang.org/grpc.(*Server).handleStream(0xc0003e6000, 0x138ab80, 0xc0004d6780, 0xc00018e500, 0x0)
2020-07-17T10:55:27.302Z [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-07-17T10:55:27.302Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00003a1d0, 0xc0003e6000, 0x138ab80, 0xc0004d6780, 0xc00018e500)
2020-07-17T10:55:27.302Z [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-07-17T10:55:27.302Z [DEBUG] plugin.terraform-provider-azuredevops_v0.0.1_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-07-17T10:55:27.302Z [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/07/17 10:55:27 [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/07/17 10:55:27 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/07/17 10:55:27 [TRACE] EvalMaybeTainted: azuredevops_git_repository.repo encountered an error during creation, so it is now marked as tainted
2020/07/17 10:55:27 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/07/17 10:55:27 [TRACE] EvalWriteState: removing state object for azuredevops_git_repository.repo
2020/07/17 10:55:27 [TRACE] <root>: eval: *terraform.EvalApplyProvisioners
2020/07/17 10:55:27 [TRACE] EvalApplyProvisioners: azuredevops_git_repository.repo has no state, so skipping provisioners
2020/07/17 10:55:27 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/07/17 10:55:27 [TRACE] EvalMaybeTainted: azuredevops_git_repository.repo encountered an error during creation, so it is now marked as tainted
2020/07/17 10:55:27 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/07/17 10:55:27 [TRACE] EvalWriteState: removing state object for azuredevops_git_repository.repo
2020/07/17 10:55:27 [TRACE] <root>: eval: *terraform.EvalIf
2020/07/17 10:55:27 [TRACE] <root>: eval: *terraform.EvalIf
2020/07/17 10:55:27 [TRACE] <root>: eval: *terraform.EvalWriteDiff
2020/07/17 10:55:27 [TRACE] <root>: eval: *terraform.EvalApplyPost
2020/07/17 10:55:27 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/07/17 10:55:27 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/07/17 10:55:27 [TRACE] [walkApply] Exiting eval tree: azuredevops_git_repository.repo
2020/07/17 10:55:27 [TRACE] vertex "azuredevops_git_repository.repo": visit complete
2020/07/17 10:55:27 [TRACE] dag/walk: upstream of "azuredevops_git_repository.fork-repo" errored, so skipping
2020/07/17 10:55:27 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/07/17 10:55:27 [TRACE] dag/walk: upstream of "provider.azuredevops (close)" errored, so skipping
2020/07/17 10:55:27 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/07/17 10:55:27 [TRACE] statemgr.Filesystem: reading latest snapshot from terraform.tfstate
2020-07-17T10:55:27.306Z [DEBUG] plugin: plugin process exited: path=/workspaces/terraform-provider-azuredevops/.terraform/plugins/linux_amd64/terraform-provider-azuredevops_v0.0.1_x4 pid=2761 error="exit status 2"
2020/07/17 10:55:27 [TRACE] statemgr.Filesystem: read snapshot with lineage "89db5adf-9c99-f180-9264-a7e3223f79de" serial 1
2020/07/17 10:55:27 [TRACE] statemgr.Filesystem: no original state snapshot to back up
2020/07/17 10:55:27 [TRACE] statemgr.Filesystem: state has changed since last snapshot, so incrementing serial to 2
2020/07/17 10:55:27 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2020/07/17 10:55:27 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/07/17 10:55:27 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2020-07-17T10:55:27.331Z [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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Expected Behavior

Error on missing setup

Actual Behavior

crash

Steps to Reproduce

  1. terraform apply
@tmeckel
Copy link
Contributor

tmeckel commented Jul 20, 2020

Is this now closed because #92 has now being merged?

@EliiseS
Copy link
Member Author

EliiseS commented Jul 20, 2020

Yup!

@EliiseS EliiseS closed this as completed Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants