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

Generate BackendService in Terraform #142

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/resources/google_compute_backend_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Properties that can be accessed from the `google_compute_backend_service` resour

* `creation_timestamp`: Creation timestamp in RFC3339 text format.

* `fingerprint`: Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking.

* `description`: An optional description of this resource.

* `enable_cdn`: If true, enable Cloud CDN for this BackendService. When the load balancing scheme is INTERNAL, this field is not used.
Expand All @@ -85,7 +87,7 @@ Properties that can be accessed from the `google_compute_backend_service` resour

* `protocol`: The protocol this BackendService uses to communicate with backends. Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. For internal load balancing, the possible values are TCP and UDP, and the default is TCP.

* `region`: The region where the regional backend service resides. This field is not applicable to global backend services.
* `security_policy`: The security policy associated with this backend service.

* `session_affinity`: Type of session affinity to use. The default is NONE. When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, or CLIENT_IP_PORT_PROTO. When the protocol is UDP, this field is not used.

Expand Down
3 changes: 2 additions & 1 deletion docs/resources/google_compute_backend_services.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ See [google_compute_backend_service.md](google_compute_backend_service.md) for m
* `cdn_policies`: an array of `google_compute_backend_service` cdn_policy
* `connection_drainings`: an array of `google_compute_backend_service` connection_draining
* `creation_timestamps`: an array of `google_compute_backend_service` creation_timestamp
* `fingerprints`: an array of `google_compute_backend_service` fingerprint
* `descriptions`: an array of `google_compute_backend_service` description
* `enable_cdns`: an array of `google_compute_backend_service` enable_cdn
* `health_checks`: an array of `google_compute_backend_service` health_checks
Expand All @@ -35,7 +36,7 @@ See [google_compute_backend_service.md](google_compute_backend_service.md) for m
* `names`: an array of `google_compute_backend_service` name
* `port_names`: an array of `google_compute_backend_service` port_name
* `protocols`: an array of `google_compute_backend_service` protocol
* `regions`: an array of `google_compute_backend_service` region
* `security_policies`: an array of `google_compute_backend_service` security_policy
* `session_affinities`: an array of `google_compute_backend_service` session_affinity
* `timeout_secs`: an array of `google_compute_backend_service` timeout_sec

Expand Down
6 changes: 4 additions & 2 deletions libraries/google_compute_backend_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class BackendService < GcpResourceBase
attr_reader :cdn_policy
attr_reader :connection_draining
attr_reader :creation_timestamp
attr_reader :fingerprint
attr_reader :description
attr_reader :enable_cdn
attr_reader :health_checks
Expand All @@ -41,7 +42,7 @@ class BackendService < GcpResourceBase
attr_reader :name
attr_reader :port_name
attr_reader :protocol
attr_reader :region
attr_reader :security_policy
attr_reader :session_affinity
attr_reader :timeout_sec

Expand All @@ -58,6 +59,7 @@ def parse
@cdn_policy = GoogleInSpec::Compute::Property::BackendServiceCdnPolicy.new(@fetched['cdnPolicy'], to_s)
@connection_draining = GoogleInSpec::Compute::Property::BackendServiceConnectionDraining.new(@fetched['connectionDraining'], to_s)
@creation_timestamp = parse_time_string(@fetched['creationTimestamp'])
@fingerprint = @fetched['fingerprint']
@description = @fetched['description']
@enable_cdn = @fetched['enableCDN']
@health_checks = @fetched['healthChecks']
Expand All @@ -67,7 +69,7 @@ def parse
@name = @fetched['name']
@port_name = @fetched['portName']
@protocol = @fetched['protocol']
@region = @fetched['region']
@security_policy = @fetched['securityPolicy']
@session_affinity = @fetched['sessionAffinity']
@timeout_sec = @fetched['timeoutSec']
end
Expand Down
6 changes: 4 additions & 2 deletions libraries/google_compute_backend_services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class BackendServices < GcpResourceBase
filter_table_config.add(:cdn_policies, field: :cdn_policy)
filter_table_config.add(:connection_drainings, field: :connection_draining)
filter_table_config.add(:creation_timestamps, field: :creation_timestamp)
filter_table_config.add(:fingerprints, field: :fingerprint)
filter_table_config.add(:descriptions, field: :description)
filter_table_config.add(:enable_cdns, field: :enable_cdn)
filter_table_config.add(:health_checks, field: :health_checks)
Expand All @@ -37,7 +38,7 @@ class BackendServices < GcpResourceBase
filter_table_config.add(:names, field: :name)
filter_table_config.add(:port_names, field: :port_name)
filter_table_config.add(:protocols, field: :protocol)
filter_table_config.add(:regions, field: :region)
filter_table_config.add(:security_policies, field: :security_policy)
filter_table_config.add(:session_affinities, field: :session_affinity)
filter_table_config.add(:timeout_secs, field: :timeout_sec)

Expand Down Expand Up @@ -84,6 +85,7 @@ def transformers
'cdnPolicy' => ->(obj) { return :cdn_policy, GoogleInSpec::Compute::Property::BackendServiceCdnPolicy.new(obj['cdnPolicy'], to_s) },
'connectionDraining' => ->(obj) { return :connection_draining, GoogleInSpec::Compute::Property::BackendServiceConnectionDraining.new(obj['connectionDraining'], to_s) },
'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) },
'fingerprint' => ->(obj) { return :fingerprint, obj['fingerprint'] },
'description' => ->(obj) { return :description, obj['description'] },
'enableCDN' => ->(obj) { return :enable_cdn, obj['enableCDN'] },
'healthChecks' => ->(obj) { return :health_checks, obj['healthChecks'] },
Expand All @@ -93,7 +95,7 @@ def transformers
'name' => ->(obj) { return :name, obj['name'] },
'portName' => ->(obj) { return :port_name, obj['portName'] },
'protocol' => ->(obj) { return :protocol, obj['protocol'] },
'region' => ->(obj) { return :region, obj['region'] },
'securityPolicy' => ->(obj) { return :security_policy, obj['securityPolicy'] },
'sessionAffinity' => ->(obj) { return :session_affinity, obj['sessionAffinity'] },
'timeoutSec' => ->(obj) { return :timeout_sec, obj['timeoutSec'] },
}
Expand Down