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.42k stars 9.51k forks source link

RDS Aurora Bug #11568

Closed mckqb-dev closed 7 years ago

mckqb-dev commented 7 years ago

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v0.8.4

Affected Resource(s)

aws_db_instance aws_rds_cluster

Terraform Configuration Files

resource "aws_db_instance" "default" { allocated_storage = 100 engine = "aurora"

engine_version = "5.6.17"

instance_class = "db.t2.medium" name = "mydb" username = "foo" password = "testing123" db_subnet_group_name = "default-vpc-abcd1234" parameter_group_name = "default.aurora5.6" }

resource "aws_rds_cluster" "default" { cluster_identifier = "tf-emr-db" availability_zones = ["us-east-1b","us-east-1c","us-east-1e"] database_name = "tf-emr-db"

}

Debug Output

Error applying plan:

2 error(s) occurred:

Terraform does not automatically rollback in the face of errors. Instead, your Terraform state file has been partially updated with any resources that successfully completed. Please address the error above and apply again to incrementally change your infrastructure. panic: interface conversion: interface is nil, not string 2017/01/31 13:26:37 [DEBUG] plugin: terraform: 2017/01/31 13:26:37 [DEBUG] plugin: terraform: goroutine 202 [running]: 2017/01/31 13:26:37 [DEBUG] plugin: terraform: panic(0x2f8b1a0, 0xc420733a00) 2017/01/31 13:26:37 [DEBUG] plugin: terraform: /opt/go/src/runtime/panic.go:500 +0x1a1 2017/01/31 13:26:37 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/aws.resourceAwsRDSClusterCreate(0xc4208a8f00, 0x2b31bc0, 0xc4204f9ba0, 0x2f90ce0, 0x167b1) 2017/01/31 13:26:37 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_rds_cluster.go:293 +0x29ec 2017/01/31 13:26:37 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(Resource).Apply(0xc4203c3e60, 0xc42070dea0, 0xc420582880, 0x2b31bc0, 0xc4204f9ba0, 0x1, 0xc42047c2a0, 0x0) 2017/01/31 13:26:37 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/helper/schema/resource.go:162 +0x30e 2017/01/31 13:26:37 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(Provider).Apply(0xc4200164e0, 0xc42070de50, 0xc42070dea0, 0xc420582880, 0x0, 0x18, 0x18) 2017/01/31 13:26:37 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/helper/schema/provider.go:212 +0x9b 2017/01/31 13:26:37 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/plugin.(ResourceProviderServer).Apply(0xc42062a5e0, 0xc420582200, 0xc420393670, 0x0, 0x0) 2017/01/31 13:26:37 [DEBUG] plugin: terraform: /opt/gopath/src/github.com/hashicorp/terraform/plugin/resource_provider.go:488 +0x57 2017/01/31 13:26:37 [DEBUG] plugin: terraform: reflect.Value.call(0xc420016660, 0xc42051a000, 0x13, 0x3621b62, 0x4, 0xc4208fdee0, 0x3, 0x3, 0x0, 0x0, ...) 2017/01/31 13:26:37 [DEBUG] plugin: terraform: /opt/go/src/reflect/value.go:434 +0x5c8 2017/01/31 13:26:37 [DEBUG] plugin: terraform: reflect.Value.Call(0xc420016660, 0xc42051a000, 0x13, 0xc4208fdee0, 0x3, 0x3, 0x0, 0x0, 0x0) 2017/01/31 13:26:37 [DEBUG] plugin: terraform: /opt/go/src/reflect/value.go:302 +0xa4 2017/01/31 13:26:37 [DEBUG] plugin: terraform: net/rpc.(service).call(0xc4202e61c0, 0xc4202e6180, 0xc4203182a0, 0xc420874100, 0xc420620120, 0x2b33e40, 0xc420582200, 0x16, 0x2b33e80, 0xc420393670, ...) 2017/01/31 13:26:37 [DEBUG] plugin: terraform: /opt/go/src/net/rpc/server.go:383 +0x148 2017/01/31 13:26:37 [DEBUG] plugin: terraform: created by net/rpc.(Server).ServeCodec 2017/01/31 13:26:37 [DEBUG] plugin: terraform: /opt/go/src/net/rpc/server.go:477 +0x421 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalWriteState 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalWriteState 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalApplyProvisioners 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalIf 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalWriteState 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalApplyProvisioners 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalWriteDiff 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalIf 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalWriteState 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalApplyPost 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalWriteDiff 2017/01/31 13:26:37 [DEBUG] root: eval: terraform.EvalApplyPost 2017/01/31 13:26:37 [ERROR] root: eval: terraform.EvalApplyPost, err: 1 error(s) occurred:

!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 Terraform1 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.

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

stack72 commented 7 years ago

Hi @mckqb-dev

Thanks so much for finding this bug - I have just been able to reproduce it and a test is running now that will stop it from happening again. The issue here is that your config is this:

resource "aws_rds_cluster" "default" {
  cluster_identifier = "tf-emr-db"
  availability_zones = ["us-east-1b","us-east-1c","us-east-1e"]
  database_name = "tf-emr-db"
}

This config is missing a master_username and master_password. The panic is because of a malformed error message within the codebase. When I fixed the panic, the output of your config would look as follows:

Error applying plan:

1 error(s) occurred:

* aws_rds_cluster.default: provider.aws: aws_rds_cluster: tf-emr-db: "master_password": required field is not set

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

I am opening a PR right now that will fix this - it will be included in Terraform 0.8.6

Thanks for the time taken here and I hope it didn't cause you too much hassle

Paul

ghost commented 4 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.