Skip to content

Commit 1ba8734

Browse files
add stack_type attribute (#9890) (#6915)
[upstream:c9187077e083299f3c1d2fd4ce5cbbb397b1ae22] Signed-off-by: Modular Magician <[email protected]>
1 parent 6b1151c commit 1ba8734

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

.changelog/9890.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
compute: added `stack_type` attribute for `google_compute_interconnect_attachment` resource.
3+
```

google-beta/services/compute/resource_compute_interconnect_attachment.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,17 @@ this interconnect attachment. Currently, only 1440 and 1500 are allowed. If not
215215
DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName,
216216
Description: `Region where the regional interconnect attachment resides.`,
217217
},
218+
"stack_type": {
219+
Type: schema.TypeString,
220+
Computed: true,
221+
Optional: true,
222+
ValidateFunc: verify.ValidateEnum([]string{"IPV4_IPV6", "IPV4_ONLY", ""}),
223+
Description: `The stack type for this interconnect attachment to identify whether the IPv6
224+
feature is enabled or not. If not specified, IPV4_ONLY will be used.
225+
226+
This field can be both set at interconnect attachments creation and update
227+
interconnect attachment operations. Possible values: ["IPV4_IPV6", "IPV4_ONLY"]`,
228+
},
218229
"type": {
219230
Type: schema.TypeString,
220231
Computed: true,
@@ -391,6 +402,12 @@ func resourceComputeInterconnectAttachmentCreate(d *schema.ResourceData, meta in
391402
} else if v, ok := d.GetOkExists("encryption"); !tpgresource.IsEmptyValue(reflect.ValueOf(encryptionProp)) && (ok || !reflect.DeepEqual(v, encryptionProp)) {
392403
obj["encryption"] = encryptionProp
393404
}
405+
stackTypeProp, err := expandComputeInterconnectAttachmentStackType(d.Get("stack_type"), d, config)
406+
if err != nil {
407+
return err
408+
} else if v, ok := d.GetOkExists("stack_type"); !tpgresource.IsEmptyValue(reflect.ValueOf(stackTypeProp)) && (ok || !reflect.DeepEqual(v, stackTypeProp)) {
409+
obj["stackType"] = stackTypeProp
410+
}
394411
regionProp, err := expandComputeInterconnectAttachmentRegion(d.Get("region"), d, config)
395412
if err != nil {
396413
return err
@@ -556,6 +573,9 @@ func resourceComputeInterconnectAttachmentRead(d *schema.ResourceData, meta inte
556573
if err := d.Set("encryption", flattenComputeInterconnectAttachmentEncryption(res["encryption"], d, config)); err != nil {
557574
return fmt.Errorf("Error reading InterconnectAttachment: %s", err)
558575
}
576+
if err := d.Set("stack_type", flattenComputeInterconnectAttachmentStackType(res["stackType"], d, config)); err != nil {
577+
return fmt.Errorf("Error reading InterconnectAttachment: %s", err)
578+
}
559579
if err := d.Set("region", flattenComputeInterconnectAttachmentRegion(res["region"], d, config)); err != nil {
560580
return fmt.Errorf("Error reading InterconnectAttachment: %s", err)
561581
}
@@ -606,6 +626,12 @@ func resourceComputeInterconnectAttachmentUpdate(d *schema.ResourceData, meta in
606626
} else if v, ok := d.GetOkExists("bandwidth"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, bandwidthProp)) {
607627
obj["bandwidth"] = bandwidthProp
608628
}
629+
stackTypeProp, err := expandComputeInterconnectAttachmentStackType(d.Get("stack_type"), d, config)
630+
if err != nil {
631+
return err
632+
} else if v, ok := d.GetOkExists("stack_type"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, stackTypeProp)) {
633+
obj["stackType"] = stackTypeProp
634+
}
609635
regionProp, err := expandComputeInterconnectAttachmentRegion(d.Get("region"), d, config)
610636
if err != nil {
611637
return err
@@ -862,6 +888,10 @@ func flattenComputeInterconnectAttachmentEncryption(v interface{}, d *schema.Res
862888
return v
863889
}
864890

891+
func flattenComputeInterconnectAttachmentStackType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
892+
return v
893+
}
894+
865895
func flattenComputeInterconnectAttachmentRegion(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
866896
if v == nil {
867897
return v
@@ -937,6 +967,10 @@ func expandComputeInterconnectAttachmentEncryption(v interface{}, d tpgresource.
937967
return v, nil
938968
}
939969

970+
func expandComputeInterconnectAttachmentStackType(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
971+
return v, nil
972+
}
973+
940974
func expandComputeInterconnectAttachmentRegion(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
941975
f, err := tpgresource.ParseGlobalFieldValue("regions", v.(string), "project", d, config, true)
942976
if err != nil {

website/docs/r/compute_interconnect_attachment.html.markdown

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,14 @@ The following arguments are supported:
216216
Default value is `NONE`.
217217
Possible values are: `NONE`, `IPSEC`.
218218

219+
* `stack_type` -
220+
(Optional)
221+
The stack type for this interconnect attachment to identify whether the IPv6
222+
feature is enabled or not. If not specified, IPV4_ONLY will be used.
223+
This field can be both set at interconnect attachments creation and update
224+
interconnect attachment operations.
225+
Possible values are: `IPV4_IPV6`, `IPV4_ONLY`.
226+
219227
* `region` -
220228
(Optional)
221229
Region where the regional interconnect attachment resides.

0 commit comments

Comments
 (0)