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 "inbound_services" to google_app_engine_standard_app_version #2131

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
3 changes: 3 additions & 0 deletions .changelog/3537.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
appengine: add `inbound_services` to `StandardAppVersion` resource
```
9 changes: 7 additions & 2 deletions google-beta/resource_app_engine_flexible_app_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,13 @@ All URLs that begin with this prefix are handled by this handler, using the port
},
},
"inbound_services": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Description: `Before an application can receive email or XMPP messages, the application must be configured to enable the service.`,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Set: schema.HashString,
},
"instance_class": {
Type: schema.TypeString,
Expand Down Expand Up @@ -1432,7 +1433,10 @@ func flattenAppEngineFlexibleAppVersionVersionId(v interface{}, d *schema.Resour
}

func flattenAppEngineFlexibleAppVersionInboundServices(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
if v == nil {
return v
}
return schema.NewSet(schema.HashString, v.([]interface{}))
}

func flattenAppEngineFlexibleAppVersionInstanceClass(v interface{}, d *schema.ResourceData, config *Config) interface{} {
Expand Down Expand Up @@ -2310,6 +2314,7 @@ func expandAppEngineFlexibleAppVersionVersionId(v interface{}, d TerraformResour
}

func expandAppEngineFlexibleAppVersionInboundServices(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
v = v.(*schema.Set).List()
return v, nil
}

Expand Down
36 changes: 36 additions & 0 deletions google-beta/resource_app_engine_standard_app_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,15 @@ All URLs that begin with this prefix are handled by this handler, using the port
},
},
},
"inbound_services": {
Type: schema.TypeSet,
Optional: true,
Description: `Before an application can receive email or XMPP messages, the application must be configured to enable the service.`,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Set: schema.HashString,
},
"instance_class": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -479,6 +488,12 @@ func resourceAppEngineStandardAppVersionCreate(d *schema.ResourceData, meta inte
} else if v, ok := d.GetOkExists("entrypoint"); !isEmptyValue(reflect.ValueOf(entrypointProp)) && (ok || !reflect.DeepEqual(v, entrypointProp)) {
obj["entrypoint"] = entrypointProp
}
inboundServicesProp, err := expandAppEngineStandardAppVersionInboundServices(d.Get("inbound_services"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("inbound_services"); !isEmptyValue(reflect.ValueOf(inboundServicesProp)) && (ok || !reflect.DeepEqual(v, inboundServicesProp)) {
obj["inboundServices"] = inboundServicesProp
}
instanceClassProp, err := expandAppEngineStandardAppVersionInstanceClass(d.Get("instance_class"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -594,6 +609,9 @@ func resourceAppEngineStandardAppVersionRead(d *schema.ResourceData, meta interf
if err := d.Set("libraries", flattenAppEngineStandardAppVersionLibraries(res["libraries"], d, config)); err != nil {
return fmt.Errorf("Error reading StandardAppVersion: %s", err)
}
if err := d.Set("inbound_services", flattenAppEngineStandardAppVersionInboundServices(res["inboundServices"], d, config)); err != nil {
return fmt.Errorf("Error reading StandardAppVersion: %s", err)
}
if err := d.Set("instance_class", flattenAppEngineStandardAppVersionInstanceClass(res["instanceClass"], d, config)); err != nil {
return fmt.Errorf("Error reading StandardAppVersion: %s", err)
}
Expand Down Expand Up @@ -673,6 +691,12 @@ func resourceAppEngineStandardAppVersionUpdate(d *schema.ResourceData, meta inte
} else if v, ok := d.GetOkExists("entrypoint"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, entrypointProp)) {
obj["entrypoint"] = entrypointProp
}
inboundServicesProp, err := expandAppEngineStandardAppVersionInboundServices(d.Get("inbound_services"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("inbound_services"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, inboundServicesProp)) {
obj["inboundServices"] = inboundServicesProp
}
instanceClassProp, err := expandAppEngineStandardAppVersionInstanceClass(d.Get("instance_class"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -973,6 +997,13 @@ func flattenAppEngineStandardAppVersionLibrariesVersion(v interface{}, d *schema
return v
}

func flattenAppEngineStandardAppVersionInboundServices(v interface{}, d *schema.ResourceData, config *Config) interface{} {
if v == nil {
return v
}
return schema.NewSet(schema.HashString, v.([]interface{}))
}

func flattenAppEngineStandardAppVersionInstanceClass(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}
Expand Down Expand Up @@ -1573,6 +1604,11 @@ func expandAppEngineStandardAppVersionEntrypointShell(v interface{}, d Terraform
return v, nil
}

func expandAppEngineStandardAppVersionInboundServices(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
v = v.(*schema.Set).List()
return v, nil
}

func expandAppEngineStandardAppVersionInstanceClass(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
Expand Down
4 changes: 4 additions & 0 deletions google-beta/resource_app_engine_standard_app_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ resource "google_app_engine_standard_app_version" "foo" {
}
}

inbound_services = ["INBOUND_SERVICE_WARMUP", "INBOUND_SERVICE_MAIL"]

env_variables = {
port = "8000"
}
Expand Down Expand Up @@ -168,6 +170,8 @@ resource "google_app_engine_standard_app_version" "foo" {
}
}

inbound_services = []

env_variables = {
port = "8000"
}
Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/app_engine_standard_app_version.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ The `files` block supports:
(Optional)
The entrypoint for the application. Structure is documented below.

* `inbound_services` -
(Optional)
Before an application can receive email or XMPP messages, the application must be configured to enable the service.

* `instance_class` -
(Optional)
Instance class that is used to run this version. Valid values are
Expand Down