mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 09:36:44 +00:00
![Radek Simko](/assets/img/avatar_default.png)
* 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
31 lines
791 B
Go
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 ""
|
|
}
|