-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
google_app_engine_service_split_traffic resource (#2269)
* Appengine Service resource * Added custom_create in custom_code. * Added appengine service resource * Updates based on review * Updates based on review * update based on review * Updates * Update * Update * Updated the example * Updated the example and website link * Skip Delete on test and noop * Rebased and merged the appengine terraform.yaml * Updates * Fixes * updated the example and excluded split from reading * updated the example * Reverted custom_create related code * Reverted resource.erb * updates * removed the error check * Updates * Fixes * Fixed the import in test script * Updates as per review * chanded the operation to OpAsync * Updated the Objects from Async to OpAsync * Fixed the example primary resource name * Testing by removing id_format and import_format * reverted import and id format and also the example * Fixed the id_format * Updates based on review * Typo fix * Changed url_param_only to api_name * Updated the resource.erb from upstream/master
- Loading branch information
Showing
8 changed files
with
174 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
templates/terraform/custom_check_destroy/skip_delete_during_test.go.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
log.Printf("[DEBUG] Ignoring destroy during test") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData) interface{} { | ||
transformed := make(map[string]string) | ||
data := v.(map[string]interface{}) | ||
for key := range data { | ||
transformed[key] = fmt.Sprintf("%f", data[key]) | ||
} | ||
log.Printf("transformed = %#v", transformed) | ||
return transformed | ||
} |
71 changes: 71 additions & 0 deletions
71
templates/terraform/examples/app_engine_service_split_traffic.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
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" "myapp_v1" { | ||
version_id = "v1" | ||
service = "myapp" | ||
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" | ||
} | ||
} | ||
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" | ||
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_app_engine_standard_app_version.myapp_v1"] | ||
} | ||
|
||
resource "google_app_engine_service_split_traffic" "myapp" { | ||
service = "${google_app_engine_standard_app_version.myapp_v2.service}" | ||
migrate_traffic = false | ||
split { | ||
shard_by = "IP" | ||
allocations = { | ||
v1 = 0.75 | ||
v2 = 0.25 | ||
} | ||
} | ||
depends_on = ["google_app_engine_standard_app_version.myapp_v2"] | ||
} | ||
|
||
|
||
resource "google_app_engine_service_split_traffic" "myapp2" { | ||
service = "${google_app_engine_standard_app_version.myapp_v2.service}" | ||
migrate_traffic = false | ||
split { | ||
allocations = { | ||
v1 = 1 | ||
} | ||
} | ||
depends_on = ["google_app_engine_service_split_traffic.myapp"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters