Skip to content

Terraform dependency issue #253

@sov-msaeed

Description

@sov-msaeed

Hello @petoju ,

I think we might have a problem here https://registry.terraform.io/providers/petoju/mysql/latest/docs/resources/grant from the example in the docs

resource "mysql_user" "jdoe" {
  user               = "jdoe"
  host               = "example.com"
  plaintext_password = "password"
}

resource "mysql_grant" "jdoe" {
  user       = mysql_user.jdoe.user
  host       = mysql_user.jdoe.host
  database   = "app"
  privileges = ["SELECT", "UPDATE"]
}

if let's say i try to change the user auth_plugin to something different, I get the plan to recreate only the user but not to recreate the grants so we will need to run terraform 2 times in this case which is not optimal. I think the issue is that the grants are relying on the name and the host no the user_id so in the grants, it should be a parameter user_id which can be the output of the previous mysql_user.jdoe.id and then it might work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions