terraform-google-modules / terraform-google-project-factory

Creates an opinionated Google Cloud project by using Shared VPC, IAM, and Google Cloud APIs
https://registry.terraform.io/modules/terraform-google-modules/project-factory/google
Apache License 2.0
826 stars 535 forks source link

Add support for Terraform v0.12 #209

Closed thefirstofthe300 closed 5 years ago

thefirstofthe300 commented 5 years ago

A dry-run of my current use case for project factory yields the following error output:

Error: Unsupported block type

  on .terraform/modules/pg_seed_project.seed_project.pg_project/terraform-google-modules-terraform-google-project-factory-f68648a/modules/core_project_factory/main.tf line 49, in resource "null_resource" "preconditions":
  49:   triggers {

Blocks of type "triggers" are not expected here. Did you mean to define
argument "triggers"? If so, use the equals sign to assign it a value.

Error: Missing resource instance key

  on .terraform/modules/pg_seed_project.seed_project.pg_project/terraform-google-modules-terraform-google-project-factory-f68648a/modules/core_project_factory/main.tf line 288, in resource "google_storage_bucket_iam_member" "group_storage_admin_on_project_bucket":
 288:   bucket = "${google_storage_bucket.project_bucket.name}"

Because google_storage_bucket.project_bucket has "count" set, its attributes
must be accessed on specific instances.

For example, to correlate with indices of a referring resource, use:
    google_storage_bucket.project_bucket[count.index]

It would be nice to be able to use the CFT with Terraform v0.12, even if the CFT doesn't yet use all of the new features for v0.12.

dhduvall commented 5 years ago

Here's another error related to 0.12 (from #214): when I run terraform init (terraform version 0.12.0) I get a pile of messages like this:

Initializing modules...
Downloading terraform-google-modules/project-factory/google 2.2.1 for project-factory...
- project-factory in .terraform/modules/project-factory/terraform-google-modules-terraform-google-project-factory-9e646bf
Downloading modules/gsuite_group for project-factory.gsuite_group...
Downloading modules/core_project_factory for project-factory.project-factory...
Downloading terraform-google-modules/network/google 0.6.0 for vpc...
- vpc in .terraform/modules/vpc/terraform-google-modules-terraform-google-network-1d3242b

Error: Module not found

The module address "modules/gsuite_group" could not be resolved.

If you intended this as a path relative to the current module, use
"./modules/gsuite_group" instead. The "./" prefix indicates that the address
is a relative filesystem path.

Error: Module not found

The module address "modules/core_project_factory" could not be resolved.

If you intended this as a path relative to the current module, use
"./modules/core_project_factory" instead. The "./" prefix indicates that the
address is a relative filesystem path.

(The two "Module not found" messages are each repeated multiple times.)

With 0.11.13, I see instead

Initializing modules...
- module.project-factory
  Found version 2.2.1 of terraform-google-modules/project-factory/google on registry.terraform.io
  Getting source "terraform-google-modules/project-factory/google"
- module.vpc
  Found version 0.6.0 of terraform-google-modules/network/google on registry.terraform.io
  Getting source "terraform-google-modules/network/google"
- module.project-factory.gsuite_group
  Getting source "modules/gsuite_group"
- module.project-factory.project-factory
  Getting source "modules/core_project_factory"

If I follow the directions in the error messages and prepend ./ to the source paths for the two modules referenced in the top-level main.tf, terraform init runs to completion with both versions.

sdouche commented 5 years ago

Hey folks :) Any update?

aaron-lane commented 5 years ago

Hi @sdouche, the implementation is being staged in #237. We hope to release by the end of next week.

morgante commented 5 years ago

Fixed in #237.