Skip to content

Commit 3bdc54e

Browse files
Add "inbound_services" to google_app_engine_standard_app_version (#3537) (#2131)
Signed-off-by: Modular Magician <[email protected]>
1 parent 801c793 commit 3bdc54e

File tree

5 files changed

+54
-2
lines changed

5 files changed

+54
-2
lines changed

.changelog/3537.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
appengine: add `inbound_services` to `StandardAppVersion` resource
3+
```

google-beta/resource_app_engine_flexible_app_version.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,12 +641,13 @@ All URLs that begin with this prefix are handled by this handler, using the port
641641
},
642642
},
643643
"inbound_services": {
644-
Type: schema.TypeList,
644+
Type: schema.TypeSet,
645645
Optional: true,
646646
Description: `Before an application can receive email or XMPP messages, the application must be configured to enable the service.`,
647647
Elem: &schema.Schema{
648648
Type: schema.TypeString,
649649
},
650+
Set: schema.HashString,
650651
},
651652
"instance_class": {
652653
Type: schema.TypeString,
@@ -1432,7 +1433,10 @@ func flattenAppEngineFlexibleAppVersionVersionId(v interface{}, d *schema.Resour
14321433
}
14331434

14341435
func flattenAppEngineFlexibleAppVersionInboundServices(v interface{}, d *schema.ResourceData, config *Config) interface{} {
1435-
return v
1436+
if v == nil {
1437+
return v
1438+
}
1439+
return schema.NewSet(schema.HashString, v.([]interface{}))
14361440
}
14371441

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

23122316
func expandAppEngineFlexibleAppVersionInboundServices(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
2317+
v = v.(*schema.Set).List()
23132318
return v, nil
23142319
}
23152320

google-beta/resource_app_engine_standard_app_version.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,15 @@ All URLs that begin with this prefix are handled by this handler, using the port
326326
},
327327
},
328328
},
329+
"inbound_services": {
330+
Type: schema.TypeSet,
331+
Optional: true,
332+
Description: `Before an application can receive email or XMPP messages, the application must be configured to enable the service.`,
333+
Elem: &schema.Schema{
334+
Type: schema.TypeString,
335+
},
336+
Set: schema.HashString,
337+
},
329338
"instance_class": {
330339
Type: schema.TypeString,
331340
Computed: true,
@@ -479,6 +488,12 @@ func resourceAppEngineStandardAppVersionCreate(d *schema.ResourceData, meta inte
479488
} else if v, ok := d.GetOkExists("entrypoint"); !isEmptyValue(reflect.ValueOf(entrypointProp)) && (ok || !reflect.DeepEqual(v, entrypointProp)) {
480489
obj["entrypoint"] = entrypointProp
481490
}
491+
inboundServicesProp, err := expandAppEngineStandardAppVersionInboundServices(d.Get("inbound_services"), d, config)
492+
if err != nil {
493+
return err
494+
} else if v, ok := d.GetOkExists("inbound_services"); !isEmptyValue(reflect.ValueOf(inboundServicesProp)) && (ok || !reflect.DeepEqual(v, inboundServicesProp)) {
495+
obj["inboundServices"] = inboundServicesProp
496+
}
482497
instanceClassProp, err := expandAppEngineStandardAppVersionInstanceClass(d.Get("instance_class"), d, config)
483498
if err != nil {
484499
return err
@@ -594,6 +609,9 @@ func resourceAppEngineStandardAppVersionRead(d *schema.ResourceData, meta interf
594609
if err := d.Set("libraries", flattenAppEngineStandardAppVersionLibraries(res["libraries"], d, config)); err != nil {
595610
return fmt.Errorf("Error reading StandardAppVersion: %s", err)
596611
}
612+
if err := d.Set("inbound_services", flattenAppEngineStandardAppVersionInboundServices(res["inboundServices"], d, config)); err != nil {
613+
return fmt.Errorf("Error reading StandardAppVersion: %s", err)
614+
}
597615
if err := d.Set("instance_class", flattenAppEngineStandardAppVersionInstanceClass(res["instanceClass"], d, config)); err != nil {
598616
return fmt.Errorf("Error reading StandardAppVersion: %s", err)
599617
}
@@ -673,6 +691,12 @@ func resourceAppEngineStandardAppVersionUpdate(d *schema.ResourceData, meta inte
673691
} else if v, ok := d.GetOkExists("entrypoint"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, entrypointProp)) {
674692
obj["entrypoint"] = entrypointProp
675693
}
694+
inboundServicesProp, err := expandAppEngineStandardAppVersionInboundServices(d.Get("inbound_services"), d, config)
695+
if err != nil {
696+
return err
697+
} else if v, ok := d.GetOkExists("inbound_services"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, inboundServicesProp)) {
698+
obj["inboundServices"] = inboundServicesProp
699+
}
676700
instanceClassProp, err := expandAppEngineStandardAppVersionInstanceClass(d.Get("instance_class"), d, config)
677701
if err != nil {
678702
return err
@@ -973,6 +997,13 @@ func flattenAppEngineStandardAppVersionLibrariesVersion(v interface{}, d *schema
973997
return v
974998
}
975999

1000+
func flattenAppEngineStandardAppVersionInboundServices(v interface{}, d *schema.ResourceData, config *Config) interface{} {
1001+
if v == nil {
1002+
return v
1003+
}
1004+
return schema.NewSet(schema.HashString, v.([]interface{}))
1005+
}
1006+
9761007
func flattenAppEngineStandardAppVersionInstanceClass(v interface{}, d *schema.ResourceData, config *Config) interface{} {
9771008
return v
9781009
}
@@ -1573,6 +1604,11 @@ func expandAppEngineStandardAppVersionEntrypointShell(v interface{}, d Terraform
15731604
return v, nil
15741605
}
15751606

1607+
func expandAppEngineStandardAppVersionInboundServices(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
1608+
v = v.(*schema.Set).List()
1609+
return v, nil
1610+
}
1611+
15761612
func expandAppEngineStandardAppVersionInstanceClass(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
15771613
return v, nil
15781614
}

google-beta/resource_app_engine_standard_app_version_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ resource "google_app_engine_standard_app_version" "foo" {
8484
}
8585
}
8686
87+
inbound_services = ["INBOUND_SERVICE_WARMUP", "INBOUND_SERVICE_MAIL"]
88+
8789
env_variables = {
8890
port = "8000"
8991
}
@@ -168,6 +170,8 @@ resource "google_app_engine_standard_app_version" "foo" {
168170
}
169171
}
170172
173+
inbound_services = []
174+
171175
env_variables = {
172176
port = "8000"
173177
}

website/docs/r/app_engine_standard_app_version.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ The `files` block supports:
197197
(Optional)
198198
The entrypoint for the application. Structure is documented below.
199199

200+
* `inbound_services` -
201+
(Optional)
202+
Before an application can receive email or XMPP messages, the application must be configured to enable the service.
203+
200204
* `instance_class` -
201205
(Optional)
202206
Instance class that is used to run this version. Valid values are

0 commit comments

Comments
 (0)