Skip to content

Commit

Permalink
add the ability to specify app engine database type (#3646) (#6629)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jun 17, 2020
1 parent ea20094 commit 01c67c3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/3646.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
app_engine: added the option to specify `database_type` in `google_app_engine_application`
```
13 changes: 12 additions & 1 deletion google/resource_app_engine_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ func resourceAppEngineApplication() *schema.Resource {
}, false),
Computed: true,
},
"database_type": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
"CLOUD_FIRESTORE",
"CLOUD_DATASTORE_COMPATIBILITY",
}, false),
Computed: true,
},
"feature_settings": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -221,6 +230,7 @@ func resourceAppEngineApplicationRead(d *schema.ResourceData, meta interface{})
d.Set("app_id", app.Id)
d.Set("serving_status", app.ServingStatus)
d.Set("gcr_domain", app.GcrDomain)
d.Set("database_type", app.DatabaseType)
d.Set("project", pid)
dispatchRules, err := flattenAppEngineApplicationDispatchRules(app.DispatchRules)
if err != nil {
Expand Down Expand Up @@ -265,7 +275,7 @@ func resourceAppEngineApplicationUpdate(d *schema.ResourceData, meta interface{}
defer mutexKV.Unlock(lockName)

log.Printf("[DEBUG] Updating App Engine App")
op, err := config.clientAppEngine.Apps.Patch(pid, app).UpdateMask("authDomain,servingStatus,featureSettings.splitHealthChecks,iap").Do()
op, err := config.clientAppEngine.Apps.Patch(pid, app).UpdateMask("authDomain,databaseType,servingStatus,featureSettings.splitHealthChecks,iap").Do()
if err != nil {
return fmt.Errorf("Error updating App Engine application: %s", err.Error())
}
Expand All @@ -291,6 +301,7 @@ func expandAppEngineApplication(d *schema.ResourceData, project string) (*appeng
LocationId: d.Get("location_id").(string),
Id: project,
GcrDomain: d.Get("gcr_domain").(string),
DatabaseType: d.Get("database_type").(string),
ServingStatus: d.Get("serving_status").(string),
}
featureSettings, err := expandAppEngineApplicationFeatureSettings(d)
Expand Down
2 changes: 2 additions & 0 deletions google/resource_app_engine_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ resource "google_app_engine_application" "acceptance" {
project = google_project.acceptance.project_id
auth_domain = "hashicorptest.com"
location_id = "us-central"
database_type = "CLOUD_DATASTORE_COMPATIBILITY"
serving_status = "SERVING"
}
`, pid, pid, org)
Expand All @@ -118,6 +119,7 @@ resource "google_app_engine_application" "acceptance" {
project = google_project.acceptance.project_id
auth_domain = "tf-test.club"
location_id = "us-central"
database_type = "CLOUD_DATASTORE_COMPATIBILITY"
serving_status = "USER_DISABLED"
}
`, pid, pid, org)
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/app_engine_application.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ The following arguments are supported:

* `auth_domain` - (Optional) The domain to authenticate users with when using App Engine's User API.

* `database_type` - (Optional) The type of the Cloud Firestore or Cloud Datastore database associated with this application.

* `serving_status` - (Optional) The serving status of the app.

* `feature_settings` - (Optional) A block of optional settings to configure specific App Engine features:
Expand Down

0 comments on commit 01c67c3

Please sign in to comment.