-
Notifications
You must be signed in to change notification settings - Fork 71
Description
It seems limiting that the provider does not have a first class data/resource representation of a server instance, but rather the server instance is defined inside the provider block.
I am trying to grant roles on a database server that is created on GCP cloud using a count meta-argument.
It seems the only way to refer to multiple mysql server instances is to create multiple provider blocks with aliases for each server instance, and then use the provider meta-argument in resources to tie the resource to a particular server. In my case this does not work because the server instances are created with a count, and the provider block does not support the count meta-argument.
Am i missing something that would allow me to create a mysql_grant resource, with a count, that referenced each mysql server created with the same count variable.
How to tie these two resources together?
resource "google_sql_database_instance" "mysql_store" {
count = var.mysql_store_count
name = "store-${local.deployment_name}-${count.index}
}
resource "mysql_grant" "jdoe" {
count = var.mysql_store_count
user = mysql_user.jdoe.user
host = mysql_user.jdoe.host
database = "app"
privileges = ["SELECT", "UPDATE"]
}