Skip to content

Commit

Permalink
Terraform Pub/Sub fix, do not send name on topic/subscription creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
drebes committed Jun 7, 2019
1 parent f51f1f7 commit 48c6e30
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions products/pubsub/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides
diff_suppress_func: 'compareSelfLinkOrResourceName'
custom_expand: templates/terraform/custom_expand/resource_from_self_link.go.erb
custom_flatten: templates/terraform/custom_flatten/name_from_self_link.erb
custom_code: !ruby/object:Provider::Terraform::CustomCode
encoder: templates/terraform/encoders/pubsub_noname.go.erb
Subscription: !ruby/object:Overrides::Terraform::ResourceOverride
id_format: "projects/{{project}}/subscriptions/{{name}}"
examples:
Expand Down Expand Up @@ -71,6 +73,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
custom_code: !ruby/object:Provider::Terraform::CustomCode
constants: templates/terraform/constants/subscription.go.erb
decoder: templates/terraform/decoders/pubsub_subscription.erb
encoder: templates/terraform/encoders/pubsub_noname.go.erb
extra_schema_entry: templates/terraform/extra_schema_entry/pubsub_subscription_path.erb
update_encoder: templates/terraform/update_encoder/pubsub_subscription.erb

Expand Down
16 changes: 16 additions & 0 deletions templates/terraform/encoders/pubsub_noname.go.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%# 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.
-%>
delete(obj, "name")
return obj, nil

0 comments on commit 48c6e30

Please sign in to comment.