driftctl/pkg/terraform/provider_config.go

33 lines
600 B
Go
Raw Normal View History

package terraform
import (
"fmt"
"runtime"
)
type ProviderConfig struct {
Key string
Version string
ConfigDir string
}
func (c *ProviderConfig) GetDownloadUrl() string {
2021-02-18 14:59:45 +00:00
arch := runtime.GOARCH
2021-02-17 08:59:51 +00:00
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
arch = "amd64"
}
return fmt.Sprintf(
"https://releases.hashicorp.com/terraform-provider-%s/%s/terraform-provider-%s_%s_%s_%s.zip",
c.Key,
c.Version,
c.Key,
c.Version,
runtime.GOOS,
2021-02-17 08:59:51 +00:00
arch,
)
}
func (c *ProviderConfig) GetBinaryName() string {
return fmt.Sprintf("terraform-provider-%s_v%s", c.Key, c.Version)
}