I have created the generic terraform resource code for instance creation. Which includes the service_account
child block.
Expected behavior:
-
User1 should to consume my code to create VM instance and attach a service account
-
User2 also should consume the same code, but to create only the VM instance and do not want to attach the service account.
Please suggest me how can I achieve this scenario
Generic TF code:
resource "google_compute_instance" "poc-instance" {
...
...
service_account {
email = google_service_account.test_service_account.email
scopes = ["storage-rw"]
}
}