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 support for multiple formats for pubsub refs in source repo (Goog…
…leCloudPlatform#3339) * Add support for multiple formats for pubsub refs in source repo (a TypeMap's key_value). * Add docs * Return string * Handle err, assert type * Assert more types * Use empty strings, not nils * Update overrides/terraform/property_override.rb * Pull utils function to source_repo_utils, make regex constant * fmt
- Loading branch information
1 parent
d46a2cc
commit 1d4e76f
Showing
8 changed files
with
57 additions
and
5 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
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
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
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 @@ | ||
package google | ||
|
||
import "regexp" | ||
|
||
func expandSourceRepoRepositoryPubsubConfigsTopic(v interface{}, d TerraformResourceData, config *Config) (string, error) { | ||
// short-circuit if the topic is a full uri so we don't need to getProject | ||
ok, err := regexp.MatchString(PubsubTopicRegex, v.(string)) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
if ok { | ||
return v.(string), nil | ||
} | ||
|
||
project, err := getProject(d, config) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return getComputedTopicName(project, v.(string)), err | ||
} |
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