Skip to content

Commit

Permalink
GA encrypted_interconnect_router on compute router (#5397) (#10454)
Browse files Browse the repository at this point in the history
* GA encrypted_interconnect_router on compute router

* Readd note on encrypted interconnect not being GA

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Oct 29, 2021
1 parent 974fa93 commit c86faa4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/5397.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: added `encrypted_interconnect_router` to `google_compute_router` (GA only)
```
26 changes: 26 additions & 0 deletions google/resource_compute_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ CIDR-formatted string.`,
Optional: true,
Description: `An optional description of this resource.`,
},
"encrypted_interconnect_router": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Description: `Field to indicate if a router is dedicated to use with encrypted
Interconnect Attachment (IPsec-encrypted Cloud Interconnect feature).
Not currently available publicly.`,
},
"region": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -212,6 +221,12 @@ func resourceComputeRouterCreate(d *schema.ResourceData, meta interface{}) error
} else if v, ok := d.GetOkExists("bgp"); ok || !reflect.DeepEqual(v, bgpProp) {
obj["bgp"] = bgpProp
}
encryptedInterconnectRouterProp, err := expandComputeRouterEncryptedInterconnectRouter(d.Get("encrypted_interconnect_router"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("encrypted_interconnect_router"); !isEmptyValue(reflect.ValueOf(encryptedInterconnectRouterProp)) && (ok || !reflect.DeepEqual(v, encryptedInterconnectRouterProp)) {
obj["encryptedInterconnectRouter"] = encryptedInterconnectRouterProp
}
regionProp, err := expandComputeRouterRegion(d.Get("region"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -321,6 +336,9 @@ func resourceComputeRouterRead(d *schema.ResourceData, meta interface{}) error {
if err := d.Set("bgp", flattenComputeRouterBgp(res["bgp"], d, config)); err != nil {
return fmt.Errorf("Error reading Router: %s", err)
}
if err := d.Set("encrypted_interconnect_router", flattenComputeRouterEncryptedInterconnectRouter(res["encryptedInterconnectRouter"], d, config)); err != nil {
return fmt.Errorf("Error reading Router: %s", err)
}
if err := d.Set("region", flattenComputeRouterRegion(res["region"], d, config)); err != nil {
return fmt.Errorf("Error reading Router: %s", err)
}
Expand Down Expand Up @@ -561,6 +579,10 @@ func flattenComputeRouterBgpAdvertisedIpRangesDescription(v interface{}, d *sche
return v
}

func flattenComputeRouterEncryptedInterconnectRouter(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenComputeRouterRegion(v interface{}, d *schema.ResourceData, config *Config) interface{} {
if v == nil {
return v
Expand Down Expand Up @@ -673,6 +695,10 @@ func expandComputeRouterBgpAdvertisedIpRangesDescription(v interface{}, d Terraf
return v, nil
}

func expandComputeRouterEncryptedInterconnectRouter(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandComputeRouterRegion(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
f, err := parseGlobalFieldValue("regions", v.(string), "project", d, config, true)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/compute_router.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The following arguments are supported:
Structure is [documented below](#nested_bgp).

* `encrypted_interconnect_router` -
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
(Optional)
Field to indicate if a router is dedicated to use with encrypted
Interconnect Attachment (IPsec-encrypted Cloud Interconnect feature).
Not currently available publicly.
Expand Down

0 comments on commit c86faa4

Please sign in to comment.