This repository was archived by the owner on Jan 12, 2021. It is now read-only.

Description
This issue was originally opened by @michalmedvecky as hashicorp/terraform#11935. It was migrated here as part of the provider split. The original body of the issue is below.
Terraform Version
Terraform v0.8.6
Affected Resource(s)
- mysql_database
- maybe other MySQL resources
Terraform Configuration Files
provider "mysql" {
endpoint = "somewhere.example.com:3306"
username = "root"
password = "password"
}
# Create a Database
resource "mysql_database" "test" {
name = "test-deleteme"
}
Debug Output
terraform plan -state new.tfstate -target mysql_database.test
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but
will not be persisted to local or remote state storage.
Error refreshing state: 1 error(s) occurred:
* Malformed version: 10.1.21-MariaDB-1~xenial
Expected Behavior
mysql_database.test: Creating...
default_character_set: "" => "utf8"
default_collation: "" => "utf8_general_ci"
name: "" => "test-deleteme"
mysql_database.test: Creation complete
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Actual Behavior
Weird error message appeared instead of creating the database
Steps to Reproduce
- install mariadb on Ubuntu Xenial
- create above .tf file
- run terraform apply/plan
Important Factoids
The actual problem is in builtin/providers/mysql/provider.go around line 115:
return version.NewVersion(rows[0].Str(0))
and the function itself:
http://github.com/hashicorp/go-version/version.go:
// The raw regular expression string used for testing the validity
// of a version.
const VersionRegexpRaw string = `v?([0-9]+(\.[0-9]+)*?)` +
`(-?([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` +
`(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` +
`?`
I have no idea why only version numbers that match this regex are invalid.