2021-02-08 15:42:35 +00:00
|
|
|
package terraform
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"runtime"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ProviderConfig struct {
|
2021-06-12 14:17:23 +00:00
|
|
|
Key string
|
|
|
|
Version string
|
|
|
|
ConfigDir string
|
2021-02-08 15:42:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
2021-02-08 15:42:35 +00:00
|
|
|
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,
|
2021-02-08 15:42:35 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ProviderConfig) GetBinaryName() string {
|
2021-06-03 09:43:15 +00:00
|
|
|
return fmt.Sprintf("terraform-provider-%s_v%s", c.Key, c.Version)
|
2021-02-08 15:42:35 +00:00
|
|
|
}
|