mirror of https://github.com/kubernetes/kops.git
Upgrade TF to 0.15 and include the provider's configuration_aliases
This commit is contained in:
parent
7eaa647b2a
commit
0449d6e36f
|
|
@ -92,6 +92,9 @@ For file assets, it means adding an explicit path as shown below:
|
||||||
|
|
||||||
# Required actions
|
# Required actions
|
||||||
|
|
||||||
|
* Terraform support now requires Terraform >=0.15.0.
|
||||||
|
Users on older versions must follow Terraform's recommended upgrade path of applying one minor version at a time prior to running `kops update cluster --target terraform`.
|
||||||
|
|
||||||
* The kOps Terraform support now renders managed files through the Terraform configuration instead
|
* The kOps Terraform support now renders managed files through the Terraform configuration instead
|
||||||
of writing them to S3 directly. If, after upgrading kOps and applying a new Terraform plan,
|
of writing them to S3 directly. If, after upgrading kOps and applying a new Terraform plan,
|
||||||
you subsequently downgrade to an earlier version of kOps, the generated plan will delete these
|
you subsequently downgrade to an earlier version of kOps, the generated plan will delete these
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ func (t *TerraformTarget) finishHCL2() error {
|
||||||
|
|
||||||
terraformBlock := rootBody.AppendNewBlock("terraform", []string{})
|
terraformBlock := rootBody.AppendNewBlock("terraform", []string{})
|
||||||
terraformBody := terraformBlock.Body()
|
terraformBody := terraformBlock.Body()
|
||||||
terraformBody.SetAttributeValue("required_version", cty.StringVal(">= 0.12.26"))
|
terraformBody.SetAttributeValue("required_version", cty.StringVal(">= 0.15.0"))
|
||||||
|
|
||||||
requiredProvidersBlock := terraformBody.AppendNewBlock("required_providers", []string{})
|
requiredProvidersBlock := terraformBody.AppendNewBlock("required_providers", []string{})
|
||||||
requiredProvidersBody := requiredProvidersBlock.Body()
|
requiredProvidersBody := requiredProvidersBlock.Body()
|
||||||
|
|
@ -111,9 +111,19 @@ func (t *TerraformTarget) finishHCL2() error {
|
||||||
"version": cty.StringVal(">= 2.19.0"),
|
"version": cty.StringVal(">= 2.19.0"),
|
||||||
})
|
})
|
||||||
} else if t.Cloud.ProviderID() == kops.CloudProviderAWS {
|
} else if t.Cloud.ProviderID() == kops.CloudProviderAWS {
|
||||||
|
configurationAliases := []*terraformWriter.Literal{terraformWriter.LiteralTokens("aws", "files")}
|
||||||
|
aliasesType, err := gocty.ImpliedType(configurationAliases)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
aliasesVal, err := gocty.ToCtyValue(configurationAliases, aliasesType)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
writeMap(requiredProvidersBody, "aws", map[string]cty.Value{
|
writeMap(requiredProvidersBody, "aws", map[string]cty.Value{
|
||||||
"source": cty.StringVal("hashicorp/aws"),
|
"source": cty.StringVal("hashicorp/aws"),
|
||||||
"version": cty.StringVal(">= 3.59.0"),
|
"version": cty.StringVal(">= 3.59.0"),
|
||||||
|
"configuration_aliases": aliasesVal,
|
||||||
})
|
})
|
||||||
if featureflag.Spotinst.Enabled() {
|
if featureflag.Spotinst.Enabled() {
|
||||||
writeMap(requiredProvidersBody, "spotinst", map[string]cty.Value{
|
writeMap(requiredProvidersBody, "spotinst", map[string]cty.Value{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue