Skip to content

Commit

Permalink
Updated datatype for mtu (hashicorp#4601) (hashicorp#3075)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Mar 22, 2021
1 parent 923b0c0 commit ee4d6d7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/4601.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
compute: fixed datatype for `mtu` in `google_compute_interconnect_attachment`
```
17 changes: 15 additions & 2 deletions google-beta/resource_compute_interconnect_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ traffic will traverse through. Required if type is DEDICATED, must not
be set if type is PARTNER.`,
},
"mtu": {
Type: schema.TypeString,
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `Maximum Transmission Unit (MTU), in bytes, of packets passing through
Expand Down Expand Up @@ -645,7 +645,20 @@ func flattenComputeInterconnectAttachmentDescription(v interface{}, d *schema.Re
}

func flattenComputeInterconnectAttachmentMtu(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil {
return intVal
}
}

// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}

return v // let terraform core handle it otherwise
}

func flattenComputeInterconnectAttachmentBandwidth(v interface{}, d *schema.ResourceData, config *Config) interface{} {
Expand Down
3 changes: 2 additions & 1 deletion google-beta/resource_dataproc_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"

dataproc "google.golang.org/api/dataproc/v1beta2"
"google.golang.org/api/googleapi"

dataproc "google.golang.org/api/dataproc/v1beta2"
)

func TestDataprocExtractInitTimeout(t *testing.T) {
Expand Down

0 comments on commit ee4d6d7

Please sign in to comment.