From 3a96ff5e1d63579eb1a63259703b6dbd6f47c1b9 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Mon, 1 Apr 2019 20:39:40 +0000 Subject: [PATCH] Generate BackendService in Terraform Signed-off-by: Modular Magician --- docs/resources/google_compute_backend_service.md | 4 +++- docs/resources/google_compute_backend_services.md | 3 ++- libraries/google_compute_backend_service.rb | 6 ++++-- libraries/google_compute_backend_services.rb | 6 ++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/resources/google_compute_backend_service.md b/docs/resources/google_compute_backend_service.md index 50d00c1d0..15bf8789c 100644 --- a/docs/resources/google_compute_backend_service.md +++ b/docs/resources/google_compute_backend_service.md @@ -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. @@ -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. diff --git a/docs/resources/google_compute_backend_services.md b/docs/resources/google_compute_backend_services.md index bbbd8f0b8..48ce6d878 100644 --- a/docs/resources/google_compute_backend_services.md +++ b/docs/resources/google_compute_backend_services.md @@ -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 @@ -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 diff --git a/libraries/google_compute_backend_service.rb b/libraries/google_compute_backend_service.rb index 9212325fc..9f884d9ab 100644 --- a/libraries/google_compute_backend_service.rb +++ b/libraries/google_compute_backend_service.rb @@ -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 @@ -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 @@ -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'] @@ -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 diff --git a/libraries/google_compute_backend_services.rb b/libraries/google_compute_backend_services.rb index 93789e03e..b8f38b3f6 100644 --- a/libraries/google_compute_backend_services.rb +++ b/libraries/google_compute_backend_services.rb @@ -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) @@ -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) @@ -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'] }, @@ -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'] }, }