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

App Engine API is required for creating a new project #389

Closed dooman87 closed 4 years ago

dooman87 commented 4 years ago

Hi there,

I'm not sure if it's a bug, but I would like to know why appengine.googleapis.com is listed as required API for creating a new project? I believe it's coming from modules/core_project_factory/scripts/preconditions/preconditions.py (line 242):

    REQUIRED_APIS = [
        "admin.googleapis.com",
        "appengine.googleapis.com",
        "iam.googleapis.com",
        "cloudbilling.googleapis.com",
        "cloudresourcemanager.googleapis.com",
    ]

We've just started a new project and using terraform-google-modules to create our infra. And I got questions from colleagues about App Engine API is being enabled on all projects that creating other projects (we have a deep hierarchy of projects and pipelines running)

Btw, thanks a lot for creating and supporting these modules. They are very handy!

morgante commented 4 years ago

App Engine is not required, but optional. The reason is because App Engine is a project-level resource so it can be created through Project Factory: https://github.com/terraform-google-modules/terraform-google-project-factory/blob/master/docs/TROUBLESHOOTING.md#missing-api-appenginegoogleapiscom

If you're not using Project Factory to manage App Engine, there is no need to activate it.

dooman87 commented 4 years ago

Thanks @morgante for a quick response. So, given I have terraform like that:

module "tools-project" {
  source  = "terraform-google-modules/project-factory/google"
  version = "~> 6.0"

  random_project_id = true
  name              = "tools"
  org_id            = var.org_id
  billing_account   = var.billing_account_id
  folder_id = var.folder_id

  activate_apis = [
    "cloudbuild.googleapis.com",
    "sourcerepo.googleapis.com"
  ]
}

If appengine API is not enabled on seed project then precondition check is failing when running code above and appengine.googleapis.com is listed as unsatisfied condition.

morgante commented 4 years ago

Got it, opened #390 to remove that precondition check.

dooman87 commented 4 years ago

Awesome! Thanks a lot for such a quick turnaround @morgante !