Mysql provider: Malformed version: 10.1.21-MariaDB-1~xenial
hashibot opened this issue · comments
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.
I'm seeing the same issue. Error output is:
- provider.mysql: Malformed version: 10.2.8-MariaDB-10.2.8+maria~jessie
Seeing the same: 10.3.2-MariaDB-10.3.2+maria~jessie
Hi guys,
I have the same issue here:
Error: Error running plan: 1 error(s) occurred:
* provider.mysql: Malformed version: 10.2.10-MariaDB-10.2.10+maria~jessie-log
terraform version
Terraform v0.11.1
+ provider.mysql v1.0.0
Just to update, this is broken yet again for me, because MariaDB decided to add :
to their version string
Earlier: 10.3.2-MariaDB-10.3.2+maria~jessie
Now: 10.3.6-MariaDB-1:10.3.6+maria~jessie
I'm planning to work around this by force setting the VERSION() response using the --version=
flag.
Edit: Was fairly easy to do with Terraform/Docker
Update2: The --version
fag requires atleast mariadb 10.2
I am also getting this issue with the very last container from MariaDB:
Error: Error refreshing state: 1 error(s) occurred:
* provider.mysql: Malformed version: 10.3.10-MariaDB-1:10.3.10+maria~bionic
Using the container: mariadb:10.3.10
.