title: Terrafrom & MySQL: Access denied
body: <p>I have the following code:</p>
  
  <pre><code>provider "mysql" {
    alias = "rails_production"
    endpoint = var.mysql_rails_production_host
    username = var.mysql_rails_production_user
    password = var.mysql_rails_production_password
  }
  
  resource "mysql_user" "michael_b" {
    provider = mysql.rails_production
    user = "michael.b"
    host = "%"
  }
  
  resource "mysql_user_password" "michael_b" {
    provider = mysql.rails_production
    user = mysql_user.michael_b.user
    host = mysql_user.michael_b.host
    pgp_key = "keybase:USER"
  }
  
  resource "mysql_grant" "michael_b" {
    provider = mysql.rails_production
    user = mysql_user.michael_b.user
    host = mysql_user.michael_b.host
    database = "production"
    privileges = ["SELECT"]
  }
  </code></pre>
  
  <p>And the following error:</p>
  
  <pre><code>1044: Access denied for user 'terraform'@'%' to database 'mysql'
  
  on rails_production.tf line 7, in resource "mysql_user_password" "michael_b":
     7: resource "mysql_user_password" "michael_b"
  </code></pre>
  
  <p>I don't really understand. I'm pretty sure the user <code>terraform</code> has access to the <code>mysql</code> table; I've logged to the db with the user and run a few queries, everything looks good. I can even access the <code>mysql</code> table.</p>
  
  <p>And if I run a:</p>
  
  <pre><code>SHOW GRANTS FOR 'terraform'@'%'
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>GRANT SELECT, SHOW DATABASES, CREATE USER ON *.* TO 'terraform'@'%' WITH GRANT OPTION
  </code></pre>
  
  <p>Any ideas?</p>