Skip to content

Commit

Permalink
Move App Engine components into its own submodule to avoid duplicatin…
Browse files Browse the repository at this point in the history
…g module interfaces
  • Loading branch information
thefirstofthe300 committed Feb 22, 2019
1 parent b3bc160 commit 145e66b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 71 deletions.
9 changes: 1 addition & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@ Extending the adopted spec, each change should have a link to its corresponding

### ADDED

- Added separate App Engine module. [#144]

### REMOVED

- Removed `app_engine` argument (config block).

## [1.1.0] - 2019-02-22
### ADDED
- Added separate App Engine module. [#134]
- Preconditions script checks billing account format. [#117]
- Add project_services submodule. [#133]

Expand Down
15 changes: 7 additions & 8 deletions docs/upgrading_to_project_factory_v2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,17 @@ module "project-factory" {
}
```

The new version of project factory uses granular fields prefixed by `app_engine_`. There is also an additional `app_engine_enabled` argument that needs to be set to true.
The new version of project factory uses a new module named `app_engine`. It accepts

```hcl
/// @file main.tf
module "project-factory" {
...
app_engine_enabled = true
app_engine_location_id = "${var.region}"
app_engine_auth_domain = "${var.domain}"
module "app-engine" {
project = "${var.project_id}
location_id = "${var.region}"
auth_domain = "${var.domain}"
app_engine_feature_settings = [
feature_settings = [
{
split_health_checks = true
},
Expand All @@ -54,7 +53,7 @@ module "project-factory" {
The new implementation uses the `google_app_engine_application` resource which needs to be imported into the current state (make sure to replace `$YOUR_PROJECT_ID`):

```sh
terraform import module.project-factory.module.project-factory.module.app-engine.google_app_engine_application.app $YOUR_PROJECT_ID
terraform import module.app-engine.google_app_engine_application.app $YOUR_PROJECT_ID
```

After importing, run `terraform` `plan` and `apply`.
Expand Down
5 changes: 0 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,4 @@ module "project-factory" {
bucket_name = "${var.bucket_name}"
auto_create_network = "${var.auto_create_network}"
disable_services_on_destroy = "${var.disable_services_on_destroy}"
app_engine_enabled = "${var.app_engine_enabled}"
app_engine_location_id = "${var.app_engine_location_id}"
app_engine_auth_domain = "${var.app_engine_auth_domain}"
app_engine_serving_status = "${var.app_engine_serving_status}"
app_engine_feature_settings = "${var.app_engine_feature_settings}"
}
5 changes: 1 addition & 4 deletions modules/app_engine/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
*/

resource "google_app_engine_application" "app" {
count = "${var.enabled ? 1 : 0}"

project = "${var.project_id}"

project = "${var.project_id}"
location_id = "${var.location_id}"
auth_domain = "${var.auth_domain}"
serving_status = "${var.serving_status}"
Expand Down
5 changes: 0 additions & 5 deletions modules/app_engine/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
* limitations under the License.
*/

variable "enabled" {
description = "Enable App Engine."
default = true
}

variable "project_id" {
description = "The project to enable app engine on."
}
Expand Down
12 changes: 0 additions & 12 deletions modules/core_project_factory/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,6 @@ resource "google_project" "main" {
depends_on = ["null_resource.preconditions"]
}

module "app-engine" {
source = "../app_engine"

enabled = "${var.app_engine_enabled}"

project_id = "${google_project.main.project_id}"
location_id = "${var.app_engine_location_id}"
auth_domain = "${var.app_engine_auth_domain}"
serving_status = "${var.app_engine_serving_status}"
feature_settings = "${var.app_engine_feature_settings}"
}

/******************************************
Project lien
*****************************************/
Expand Down
10 changes: 6 additions & 4 deletions test/fixtures/full/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ module "project-factory" {
]

disable_services_on_destroy = "false"
}

app_engine_enabled = true
app_engine_location_id = "${var.region}"
app_engine_auth_domain = "${var.domain}"
module "app-engine" {
project = "${module.project-factory.project_id}"
location_id = "${var.region}"
auth_domain = "${var.domain}"

app_engine_feature_settings = [
feature_settings = [
{
split_health_checks = true
},
Expand Down
25 changes: 0 additions & 25 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,28 +119,3 @@ variable "disable_services_on_destroy" {
default = "true"
type = "string"
}

variable "app_engine_enabled" {
description = "Enable App Engine on the project."
default = false
}

variable "app_engine_location_id" {
description = "The location to serve the app from."
default = ""
}

variable "app_engine_auth_domain" {
description = "The domain to authenticate users with when using App Engine's User API."
default = ""
}

variable "app_engine_serving_status" {
description = "The serving status of the App Engine application."
default = "SERVING"
}

variable "app_engine_feature_settings" {
description = "A block of optional settings to configure specific App Engine features."
default = []
}

0 comments on commit 145e66b

Please sign in to comment.