forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Pub/Sub Lite reservation support to terraform. (GoogleCloudPlatfo…
…rm#5284) * Add Pub/Sub Lite reservation support to terraform. Also fix doc links for Pub/Sub Lite. * Add Pub/Sub Lite reservation support to terraform. Also fix doc links for Pub/Sub Lite. * Add Pub/Sub Lite reservation support to terraform. Also fix doc links for Pub/Sub Lite. * Add Pub/Sub Lite reservation support to terraform. Also fix doc links for Pub/Sub Lite. * Update to expander to use 'locations' instead of 'regions'. Co-authored-by: Nathan Mckinley <[email protected]>
- Loading branch information
1 parent
e1d4b0d
commit ab57d3e
Showing
5 changed files
with
105 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...terraform/custom_expand/pubsublite_topic_reservation_config_throughput_reservation.go.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<%# # the license inside this if block pertains to this file | ||
# Copyright 2020 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. | ||
#%> | ||
func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { | ||
f, err := parseRegionalFieldValue("reservations", v.(string), "project", "region", "zone", d, config, true) | ||
if err != nil { | ||
return nil, fmt.Errorf("Invalid value for throughput_reservation: %s", err) | ||
} | ||
// Custom due to "locations" rather than "regions". | ||
return fmt.Sprintf("projects/%s/locations/%s/reservations/%s", f.Project, f.Region, f.Name), nil | ||
} |
8 changes: 8 additions & 0 deletions
8
mmv1/templates/terraform/examples/pubsub_lite_reservation_basic.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
resource "google_pubsub_lite_reservation" "<%= ctx[:primary_resource_id] %>" { | ||
name = "<%= ctx[:vars]['reservation_name'] %>" | ||
project = data.google_project.project.number | ||
throughput_capacity = 2 | ||
} | ||
|
||
data "google_project" "project" { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters