Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
vpc network custom mtu support (#4126) (#461)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Oct 19, 2020
1 parent 3becc0a commit 0161345
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/resources/google_compute_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ Properties that can be accessed from the `google_compute_network` resource:

* `peer_mtu`: Maximum Transmission Unit in bytes.

* `mtu`: Maximum Transmission Unit in bytes. The minimum value for this field is 1460 and the maximum value is 1500 bytes.


## GCP Permissions

Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_compute_networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ See [google_compute_network.md](google_compute_network.md) for more detailed inf
* `creation_timestamps`: an array of `google_compute_network` creation_timestamp
* `routing_configs`: an array of `google_compute_network` routing_config
* `peerings`: an array of `google_compute_network` peerings
* `mtus`: an array of `google_compute_network` mtu

## Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_compute_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ComputeNetwork < GcpResourceBase
attr_reader :creation_timestamp
attr_reader :routing_config
attr_reader :peerings
attr_reader :mtu

def initialize(params)
super(params.merge({ use_http_transport: true }))
Expand All @@ -51,6 +52,7 @@ def parse
@creation_timestamp = parse_time_string(@fetched['creationTimestamp'])
@routing_config = GoogleInSpec::Compute::Property::NetworkRoutingConfig.new(@fetched['routingConfig'], to_s)
@peerings = GoogleInSpec::Compute::Property::NetworkPeeringsArray.parse(@fetched['peerings'], to_s)
@mtu = @fetched['mtu']
end

# Handles parsing RFC3339 time string
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_compute_networks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class ComputeNetworks < GcpResourceBase
filter_table_config.add(:creation_timestamps, field: :creation_timestamp)
filter_table_config.add(:routing_configs, field: :routing_config)
filter_table_config.add(:peerings, field: :peerings)
filter_table_config.add(:mtus, field: :mtu)

filter_table_config.connect(self, :table)

Expand Down Expand Up @@ -80,6 +81,7 @@ def transformers
'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) },
'routingConfig' => ->(obj) { return :routing_config, GoogleInSpec::Compute::Property::NetworkRoutingConfig.new(obj['routingConfig'], to_s) },
'peerings' => ->(obj) { return :peerings, GoogleInSpec::Compute::Property::NetworkPeeringsArray.parse(obj['peerings'], to_s) },
'mtu' => ->(obj) { return :mtu, obj['mtu'] },
}
end

Expand Down

0 comments on commit 0161345

Please sign in to comment.