Skip to content

Commit

Permalink
add the ability to specify app engine database type (#3646)
Browse files Browse the repository at this point in the history
  • Loading branch information
prodaccess authored Jun 17, 2020
1 parent a242066 commit 4105e83
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
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
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
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 4105e83

Please sign in to comment.