Terraform: Crash during apply

Created on 18 Jan 2017  ·  7Comments  ·  Source: hashicorp/terraform

Terraform Version

"Terraform v0.8.4"

Affected Resource(s)

Multiple resources from within 2 modules:

  • aws_instance
  • aws_route52_record
  • aws_elb
  • aws_s3_bucket
  • aws_cloudfront_origin_access_identity
  • aws_cloudfront_distribution
  • aws_elasticache_cluster
  • aws_db_instance

Most instances were being created for the first time.

Terraform Configuration Files

Archive.zip

Debug Output

debug.log.zip
Note that my bash history did not go back far enough to retrieve the full output.

Panic Output

crash.log.zip

Expected Behavior

The resources should have been created according to the output of terraform plan.

Actual Behavior

After chugging for a short while, the application crashed.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

There are a number of external resources such as SSL certs and VPC security groups in the terraform configuration. I expected there to be some errors as this was the first attempt at running apply, but did not expect the panic.

If applicable I was also running Terraform from the Docker image. Run statement:

docker run --rm -it -v ~/.aws:/root/.aws:ro -v $PWD:/app --workdir=/app hashicorp/terraform:light apply
bug crash provideaws

Most helpful comment

@brandonpiercenb – MySQL DB names must be all alphanumeric (no hyphens)

It's difficult to validate at plan because you have many engine options. If you feel there's a bigger issue, please open another GitHub issue.

To be clear, AWS allows hyphens in the RDS Instance identifier parameter. MySQL (and others, possibly) does not allow hyphens in the database name

All 7 comments

A follow-up run produced this wall of errors which is what I was expecting, given that this is my first rodeo with Terraform :)

Error applying plan:

13 error(s) occurred:

* aws_cloudfront_distribution.distribution: InvalidArgument: The parameter Lambda function associations is required.
    status code: 400, request id: a2dbe47c-dd0a-11e6-87dd-91ebc187b2b0
* aws_elasticache_cluster.cache: Error creating Elasticache: CacheSubnetGroupNotFoundFault: Cache Subnet Group vc-csg-live-cache-zones does not exist.
    status code: 400, request id: a3e7af50-dd0a-11e6-92de-714cb0653961
* aws_s3_bucket.public: Error creating S3 bucket: BucketAlreadyOwnedByYou: Your previous request to create the named bucket succeeded and you already own it.
    status code: 409, request id: A8B84297FFD44B29
* aws_s3_bucket.private: Error creating S3 bucket: BucketAlreadyOwnedByYou: Your previous request to create the named bucket succeeded and you already own it.
    status code: 409, request id: 4082A2B4F477E655
* aws_elasticache_cluster.cache: Error creating Elasticache: CacheClusterAlreadyExists: Cache cluster already exists
    status code: 400, request id: a4955425-dd0a-11e6-8dff-b3e8e9891f05
* aws_s3_bucket.private: Error creating S3 bucket: BucketAlreadyOwnedByYou: Your previous request to create the named bucket succeeded and you already own it.
    status code: 409, request id: 1BAC95E410DBE47D
* aws_db_instance.db: Error creating DB Instance: InvalidParameterValue: DBName must begin with a letter and contain only alphanumeric characters.
    status code: 400, request id: a40a03bb-dd0a-11e6-a3a7-c3a35b5fc29f
* aws_db_instance.db: Error creating DB Instance: InvalidParameterValue: DBName must begin with a letter and contain only alphanumeric characters.
    status code: 400, request id: a4163913-dd0a-11e6-8222-af6708572542
* aws_cloudfront_distribution.cdn: InvalidViewerCertificate: The specified SSL certificate doesn't exist, isn't valid, or doesn't include a valid certificate chain.
    status code: 400, request id: a798f730-dd0a-11e6-bbbb-ed03273b2c6f
* Resource 'aws_elb.lb' not found for variable 'aws_elb.lb.dns_name'
* Resource 'aws_elb.lb' not found for variable 'aws_elb.lb.zone_id'
* module.finance-api-live.aws_elb.lb: instances.0 must be a single value, not a list
* module.finance-api-stage.aws_elb.lb: instances.0 must be a single value, not a list

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.

For discussion about the first error "InvalidArgument: The parameter Lambda function associations is required" see #10938.

aws_cloudfront_distribution.distribution: InvalidArgument: The parameter Lambda function associations is required.
status code: 400, request id: a2dbe47c-dd0a-11e6-87dd-91ebc187b2b0

This has been fixed in #11291

Receiving this too:

* aws_db_instance.mysql: Error creating DB Instance: InvalidParameterValue: DBName must begin with a letter and contain only alphanumeric characters.
    status code: 400, request id: 99d98eef-e73a-11e6-9adf-574a97319967

This happens if I specify anything for the name - even a simple "foo-bar" seems to fail. Omitting the name property for the aws_db_instance allows full creation of everything else as I would expect, though of course with a Terraform randomly generated name.

I noticed this on TF 0.84 and also now 0.85. It may have been present in previous version, however I had not created any resources of aws_db_instance type until 0.84.

Happy to provide any other information as needed.

Just ran into @brandonpiercenb issue on 0.88 as well. It failed to create with a dash in the name even though AWS RDS does allow for dashes in the name (we have one in the same account with dashes in its name). Removing the dash allowed it to create successfully.

@brandonpiercenb – MySQL DB names must be all alphanumeric (no hyphens)

It's difficult to validate at plan because you have many engine options. If you feel there's a bigger issue, please open another GitHub issue.

To be clear, AWS allows hyphens in the RDS Instance identifier parameter. MySQL (and others, possibly) does not allow hyphens in the database name

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atkinchris picture atkinchris  ·  68Comments

bloopletech picture bloopletech  ·  82Comments

kforsthoevel picture kforsthoevel  ·  86Comments

mirogta picture mirogta  ·  74Comments

lukehoersten picture lukehoersten  ·  151Comments