Skip to content

Commit

Permalink
Clean up AppEngine examples (#2512)
Browse files Browse the repository at this point in the history
Merged PR #2512.
  • Loading branch information
rileykarson authored and modular-magician committed Oct 23, 2019
1 parent a4ccdff commit cf81a3d
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 74 deletions.
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
7 changes: 3 additions & 4 deletions products/appengine/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ overrides: !ruby/object:Overrides::ResourceOverrides
examples:
- !ruby/object:Provider::Terraform::Examples
name: "app_engine_standard_app_version"
primary_resource_id: "version_id"
primary_resource_id: "myapp_v1"
ignore_read_extra:
- "noop_on_destroy"
- "delete_service_on_destroy"
vars:
project_id: "test-project"
bucket_name: "appengine-static-content"
Expand Down Expand Up @@ -102,9 +102,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides
examples:
- !ruby/object:Provider::Terraform::Examples
name: "app_engine_application_url_dispatch_rules_basic"
primary_resource_id: "service_rules"
primary_resource_id: "web_service"
vars:
project: "my-project"
bucket_name: "appengine-test-bucket"

# This is for copying files over
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
resource "google_storage_bucket" "bucket" {
name = "<%= ctx[:vars]['bucket_name'] %>"
}
resource "google_app_engine_application_url_dispatch_rules" "<%= ctx[:primary_resource_id] %>" {
dispatch_rules {
domain = "*"
path = "/*"
service = "default"
}

resource "google_storage_bucket_object" "object" {
name = "hello-world.zip"
bucket = "${google_storage_bucket.bucket.name}"
source = "./test-fixtures/appengine/hello-world.zip"
dispatch_rules {
domain = "*"
path = "/admin/*"
service = "${google_app_engine_standard_app_version.admin_v3.service}"
}
}

resource "google_app_engine_standard_app_version" "myapp_v1" {
version_id = "v1"
service = "myapp"
resource "google_app_engine_standard_app_version" "admin_v3" {
version_id = "v3"
service = "admin"
runtime = "nodejs10"
noop_on_destroy = true

entrypoint {
shell = "node ./app.js"
}

deployment {
zip {
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/hello-world.zip"
}
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}"
}
}

env_variables = {
port = "8080"
}
depends_on = ["google_storage_bucket_object.object"]
}

noop_on_destroy = true
}

resource "google_app_engine_application_url_dispatch_rules" "service_rules" {
# project = "my-project"
dispatch_rules {
domain = "*"
path = "/default/*"
service = "default"
}
dispatch_rules {
domain = "*"
path = "/myapp/*"
service = "${google_app_engine_standard_app_version.myapp_v1.service}"
}
resource "google_storage_bucket" "bucket" {
name = "<%= ctx[:vars]['bucket_name'] %>"
}

resource "google_storage_bucket_object" "object" {
name = "hello-world.zip"
bucket = "${google_storage_bucket.bucket.name}"
source = "./test-fixtures/appengine/hello-world.zip"
}
70 changes: 29 additions & 41 deletions templates/terraform/examples/app_engine_standard_app_version.tf.erb
Original file line number Diff line number Diff line change
@@ -1,65 +1,53 @@
resource "google_storage_bucket" "bucket" {
name = "<%= ctx[:vars]['bucket_name'] %>"
}

resource "google_storage_bucket_object" "object" {
name = "hello-world.zip"
bucket = "${google_storage_bucket.bucket.name}"
source = "./test-fixtures/appengine/hello-world.zip"
}

resource "google_app_engine_standard_app_version" "<%= ctx[:primary_resource_id] %>" {
version_id = "v2"
service = "default"
runtime = "nodejs10"
noop_on_destroy = true
version_id = "v1"
service = "myapp"
runtime = "nodejs10"

entrypoint {
shell = "node ./app.js"
}

deployment {
zip {
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/hello-world.zip"
}
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}"
}
}

env_variables = {
port = "8080"
}

}
}

resource "google_app_engine_standard_app_version" "myapp_v1" {
version_id = "v1"
service = "myapp"
runtime = "nodejs10"
delete_service_on_destroy = true
entrypoint {
shell = "node ./app.js"
}
deployment {
zip {
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/hello-world.zip"
}
}
env_variables = {
port = "8080"
}
depends_on = ["google_storage_bucket_object.object"]
}

resource "google_app_engine_standard_app_version" "myapp_v2" {
version_id = "v2"
service = "myapp"
runtime = "nodejs10"
service = "myapp"
runtime = "nodejs10"

entrypoint {
shell = "node ./app.js"
}

deployment {
zip {
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/hello-world.zip"
}
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}"
}
}

env_variables = {
port = "8080"
}
depends_on = ["google_app_engine_standard_app_version.myapp_v1"]
}

noop_on_destroy = true
}

resource "google_storage_bucket" "bucket" {
name = "<%= ctx[:vars]['bucket_name'] %>"
}

resource "google_storage_bucket_object" "object" {
name = "hello-world.zip"
bucket = "${google_storage_bucket.bucket.name}"
source = "./test-fixtures/appengine/hello-world.zip"
}

0 comments on commit cf81a3d

Please sign in to comment.