terraform-provider-google/vendor/github.com/hashicorp/terraform/moduledeps/provider.go
Radek Simko a1a064f154 vendor: github.com/hashicorp/terraform@v0.10.0 (#302)
* vendor: Ignore github.com/hashicorp/terraform/backend

This is to avoid dependency sprawl - e.g. vendoring AWS or Azure SDK
when we don't really need remote backend functionality
in provider code - it's core's responsibility.

* vendor: github.com/hashicorp/terraform/...@v0.10.0
2017-08-09 10:28:48 -05:00

31 lines
791 B
Go

package moduledeps
import (
"strings"
)
// ProviderInstance describes a particular provider instance by its full name,
// like "null" or "aws.foo".
type ProviderInstance string
// Type returns the provider type of this instance. For example, for an instance
// named "aws.foo" the type is "aws".
func (p ProviderInstance) Type() string {
t := string(p)
if dotPos := strings.Index(t, "."); dotPos != -1 {
t = t[:dotPos]
}
return t
}
// Alias returns the alias of this provider, if any. An instance named "aws.foo"
// has the alias "foo", while an instance named just "docker" has no alias,
// so the empty string would be returned.
func (p ProviderInstance) Alias() string {
t := string(p)
if dotPos := strings.Index(t, "."); dotPos != -1 {
return t[dotPos+1:]
}
return ""
}