Skip to content

Commit

Permalink
Fix minor issues, make tests green.
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson committed Apr 2, 2019
1 parent d8bed78 commit 7a8110a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 1 addition & 7 deletions products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -581,13 +581,7 @@ objects:
When the load balancing scheme is INTERNAL, this field is not used.
- !ruby/object:Api::Type::Array
name: 'healthChecks'
item_type: !ruby/object:Api::Type::ResourceRef
name: 'healthCheck'
description: 'A HealthCheck'
# Not technically true, but we don't support multi-resource refs yet
# and none of Terraform / Ansible / InSpec care about the type
resource: 'HealthCheck'
imports: 'selfLink'
item_type: Api::Type::String
required: true
min_size: 1
max_size: 1
Expand Down
1 change: 1 addition & 0 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
healthChecks: !ruby/object:Overrides::Terraform::PropertyOverride
is_set: true
set_hash_func: 'selfLinkRelativePathHash'
custom_flatten: templates/terraform/custom_flatten/guard_self_link_array.go.erb
iap: !ruby/object:Overrides::Terraform::PropertyOverride
send_empty_value: true
iap.enabled: !ruby/object:Overrides::Terraform::PropertyOverride
Expand Down
21 changes: 21 additions & 0 deletions templates/terraform/custom_flatten/guard_self_link_array.go.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<%# The license inside this block applies to this file.
# Copyright 2019 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-%>
<%# This should be used for multi-resource ref fields that can't be made to real resource refs yet %>
func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData) interface{} {
if v == nil {
return v
}
return convertAndMapStringArr(v.([]interface{}), ConvertSelfLinkToV1)
}
2 changes: 1 addition & 1 deletion templates/terraform/examples/backend_service_basic.tf.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['backend_service_name'] %>"
health_checks = ["${google_compute_http_health_check.zero.self_link}"]
health_checks = ["${google_compute_http_health_check.default.self_link}"]
}

resource "google_compute_http_health_check" "default" {
Expand Down

0 comments on commit 7a8110a

Please sign in to comment.