hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.71k stars 9.55k forks source link

Provider mongodb issue - 0.12.24: panic: runtime error: invalid memory address or nil pointer dereference #27646

Closed AlienGUIse closed 3 years ago

AlienGUIse commented 3 years ago

Hi guys,

Facing this issue with Terraform version 0.12.24 and mongodb 0.4.2. Log output have been attached in this post. Not sure if anyone have/had similar issue ?

thanks

Terraform Version

Terraform Version: 0.12.24
MongoDB Atlas Provider version: 0.4.2

Terraform Configuration Files

resource "mongodbatlas_project" "db_project" {
  name   = "${var.env}-${var.app_name}"
  org_id = var.atlas_orgid

  lifecycle {
    ignore_changes = [teams]
  }
}

resource "mongodbatlas_cluster" "mongodb" {
  name                    = replace(substr("${var.env}-${var.app_name}-db", 0, 22), "/-$/", "")
  project_id              = mongodbatlas_project.db_project.id
  num_shards              = 1
  replication_factor      = 3
  provider_backup_enabled = var.atlas_backup

  provider_name               = var.atlas_provider
  backing_provider_name       = var.atlas_backing_provider
  provider_instance_size_name = var.atlas_instance
  provider_region_name        = upper(replace(var.region, "-", "_")) 
  disk_size_gb                = var.atlas_storage

  mongo_db_major_version       = "4.2"
  auto_scaling_disk_gb_enabled = false
}

resource "mongodbatlas_project_ip_whitelist" "allow_all" {
  project_id = mongodbatlas_project.db_project.id
  cidr_block = "0.0.0.0/0"
  comment = "allow all"
}

resource "mongodbatlas_database_user" "app_user" {
  auth_database_name = "xxx"
  project_id = mongodbatlas_project.db_project.id
  username = "${var.app_name}-user"
  password = "xxx" 

  roles {
    role_name = "readWrite"
    database_name = var.atlas_db_name
  }

  lifecycle {
    ignore_changes = [password]
  }
}

Debug Output

panic: runtime error: invalid memory address or nil pointer dereference
--
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe2095d]
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:
  | 2021/02/01 00:05:10 [ERROR] <root>: eval: *terraform.EvalRefresh, err: rpc error: code = Unavailable desc = transport is closing
  | 2021/02/01 00:05:10 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
  | 2021/02/01 00:05:10 [TRACE] [walkRefresh] Exiting eval tree: mongodbatlas_cluster.mongodb
  | 2021/02/01 00:05:10 [TRACE] vertex "mongodbatlas_cluster.mongodb": visit complete
  | 2021/02/01 00:05:10 [TRACE] vertex "mongodbatlas_cluster.mongodb": dynamic subgraph encountered errors
  | 2021/02/01 00:05:10 [TRACE] vertex "mongodbatlas_cluster.mongodb": visit complete
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: goroutine 72 [running]:
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: github.com/terraform-providers/terraform-provider-mongodbatlas/mongodbatlas.flattenProcessArgs(0xc0003d7b00, 0x131c480)
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-mongodbatlas/mongodbatlas/resource_mongodbatlas_cluster.go:963 +0x3d
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: github.com/terraform-providers/terraform-provider-mongodbatlas/mongodbatlas.resourceMongoDBAtlasClusterRead(0xc0001c0d20, 0xf98d20, 0xc00044d520, 0xc0001c0d20, 0x0)
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-mongodbatlas/mongodbatlas/resource_mongodbatlas_cluster.go:587 +0x2819
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: github.com/hashicorp/terraform/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000440d80, 0xc0005dcfa0, 0xf98d20, 0xc00044d520, 0xc0005c0870, 0xc0005dcfa0, 0x0)
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-mongodbatlas/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:447 +0x119
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ReadResource(0xc0001285b8, 0x131c500, 0xc00066aab0, 0xc000079e40, 0xc0001285b8, 0xc00066aab0, 0xc00023dbd0)
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-mongodbatlas/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:496 +0x334
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: github.com/hashicorp/terraform/internal/tfplugin5._Provider_ReadResource_Handler(0x107e260, 0xc0001285b8, 0x131c500, 0xc00066aab0, 0xc000598cc0, 0x0, 0x131c500, 0xc00066aab0, 0xc000461c00, 0x6e7)
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-mongodbatlas/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go:2983 +0x23e
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000274000, 0x1328f80, 0xc0001dd380, 0xc00047e700, 0xc00011f290, 0x1b3d770, 0x0, 0x0, 0x0)
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-mongodbatlas/vendor/google.golang.org/grpc/server.go:995 +0x466
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: google.golang.org/grpc.(*Server).handleStream(0xc000274000, 0x1328f80, 0xc0001dd380, 0xc00047e700, 0x0)
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-mongodbatlas/vendor/google.golang.org/grpc/server.go:1275 +0xda6
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00012a090, 0xc000274000, 0x1328f80, 0xc0001dd380, 0xc00047e700)
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-mongodbatlas/vendor/google.golang.org/grpc/server.go:710 +0x9f
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
  | 2021-02-01T00:05:10.023Z [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.2_x4:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-mongodbatlas/vendor/google.golang.org/grpc/server.go:708 +0xa1
  | 2021/02/01 00:05:10 [TRACE] dag/walk: upstream of "output.atlas_db_hostname" errored, so skipping
  | 2021/02/01 00:05:10 [TRACE] dag/walk: upstream of "provider.mongodbatlas (close)" errored, so skipping
  | 2021-02-01T00:05:10.024Z [DEBUG] plugin: plugin process exited: path=/var/lib/buildkite-agent/builds/ip-10-0-2-60-ec2-internal-1/sdd-services/t-service-dev/deploy/.terraform/plugins/linux_amd64/terraform-provider-mongodbatlas_v0.4.2_x4 pid=9246 error="exit status 2"
  | 2021-02-01T00:05:10.025Z [DEBUG] plugin.terraform-provider-aws_v2.70.0_x4: 2021/02/01 00:05:10 [DEBUG] [aws-sdk-go] DEBUG: Response

Crash Output

Expected Behavior

Actual Behavior

Steps to Reproduce

Additional Context

References

AlienGUIse commented 3 years ago

This has been resolved

ghost commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.