aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/moduledeps/provider.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/moduledeps/provider.go')
-rw-r--r--vendor/github.com/hashicorp/terraform/moduledeps/provider.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/moduledeps/provider.go b/vendor/github.com/hashicorp/terraform/moduledeps/provider.go
new file mode 100644
index 0000000..89ceefb
--- /dev/null
+++ b/vendor/github.com/hashicorp/terraform/moduledeps/provider.go
@@ -0,0 +1,30 @@
1package moduledeps
2
3import (
4 "strings"
5)
6
7// ProviderInstance describes a particular provider instance by its full name,
8// like "null" or "aws.foo".
9type ProviderInstance string
10
11// Type returns the provider type of this instance. For example, for an instance
12// named "aws.foo" the type is "aws".
13func (p ProviderInstance) Type() string {
14 t := string(p)
15 if dotPos := strings.Index(t, "."); dotPos != -1 {
16 t = t[:dotPos]
17 }
18 return t
19}
20
21// Alias returns the alias of this provider, if any. An instance named "aws.foo"
22// has the alias "foo", while an instance named just "docker" has no alias,
23// so the empty string would be returned.
24func (p ProviderInstance) Alias() string {
25 t := string(p)
26 if dotPos := strings.Index(t, "."); dotPos != -1 {
27 return t[dotPos+1:]
28 }
29 return ""
30}