Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the ability to specify app engine database type #3646

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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