diff --git a/.changelog/3646.txt b/.changelog/3646.txt new file mode 100644 index 00000000000..fe69b0e1abb --- /dev/null +++ b/.changelog/3646.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +app_engine: added the option to specify `database_type` in `google_app_engine_application` +``` diff --git a/google/resource_app_engine_application.go b/google/resource_app_engine_application.go index 5163480bb1a..510d99caa22 100644 --- a/google/resource_app_engine_application.go +++ b/google/resource_app_engine_application.go @@ -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, @@ -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 { @@ -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()) } @@ -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) diff --git a/google/resource_app_engine_application_test.go b/google/resource_app_engine_application_test.go index 405ce7bbc87..b5400a235d0 100644 --- a/google/resource_app_engine_application_test.go +++ b/google/resource_app_engine_application_test.go @@ -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) @@ -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) diff --git a/website/docs/r/app_engine_application.html.markdown b/website/docs/r/app_engine_application.html.markdown index 1bf01beb71d..e6390c84692 100644 --- a/website/docs/r/app_engine_application.html.markdown +++ b/website/docs/r/app_engine_application.html.markdown @@ -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: