'Is there a way to add multiple things into source of google_storage_bucket_object?

The HTML files has a separate css stylesheet and svg images in it that are in different files.

resource "google_storage_bucket_object" "index" {
  name   = var.index_page
  source = var.htmlFile //add more stuff
  bucket = google_storage_bucket.website.name
}


Solution 1:[1]

i think you can use Terraform fileset funcion. Put all your files in a directory and with a for_each iterate on the fileset.

resource "example_thing" "example" {
  for_each = fileset(path.module, "files/*")

  # other configuration using each.value
}

I hope is helpful :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Danilo Cacace