@@ -72,6 +72,7 @@ const (
72
72
CheckoutStrategyFlag = "checkout-strategy"
73
73
ConfigFlag = "config"
74
74
DataDirFlag = "data-dir"
75
+ DefaultTFDistributionFlag = "default-tf-distribution"
75
76
DefaultTFVersionFlag = "default-tf-version"
76
77
DisableApplyAllFlag = "disable-apply-all"
77
78
DisableAutoplanFlag = "disable-autoplan"
@@ -141,7 +142,7 @@ const (
141
142
SSLCertFileFlag = "ssl-cert-file"
142
143
SSLKeyFileFlag = "ssl-key-file"
143
144
RestrictFileList = "restrict-file-list"
144
- TFDistributionFlag = "tf-distribution"
145
+ TFDistributionFlag = "tf-distribution" // deprecated for DefaultTFDistributionFlag
145
146
TFDownloadFlag = "tf-download"
146
147
TFDownloadURLFlag = "tf-download-url"
147
148
UseTFPluginCache = "use-tf-plugin-cache"
@@ -421,8 +422,8 @@ var stringFlags = map[string]stringFlag{
421
422
description : fmt .Sprintf ("File containing x509 private key matching --%s." , SSLCertFileFlag ),
422
423
},
423
424
TFDistributionFlag : {
424
- description : fmt . Sprintf ( "Which TF distribution to use. Can be set to %s or %s." , TFDistributionTerraform , TFDistributionOpenTofu ) ,
425
- defaultValue : DefaultTFDistribution ,
425
+ description : "[Deprecated for --default-tf- distribution]." ,
426
+ hidden : true ,
426
427
},
427
428
TFDownloadURLFlag : {
428
429
description : "Base URL to download Terraform versions from." ,
@@ -437,6 +438,10 @@ var stringFlags = map[string]stringFlag{
437
438
" Only set if using TFC/E as a remote backend." +
438
439
" Should be specified via the ATLANTIS_TFE_TOKEN environment variable for security." ,
439
440
},
441
+ DefaultTFDistributionFlag : {
442
+ description : fmt .Sprintf ("Which TF distribution to use. Can be set to %s or %s." , TFDistributionTerraform , TFDistributionOpenTofu ),
443
+ defaultValue : DefaultTFDistribution ,
444
+ },
440
445
DefaultTFVersionFlag : {
441
446
description : "Terraform version to default to (ex. v0.12.0). Will download if not yet on disk." +
442
447
" If not set, Atlantis uses the terraform binary in its PATH." ,
@@ -840,12 +845,13 @@ func (s *ServerCmd) run() error {
840
845
841
846
// Config looks good. Start the server.
842
847
server , err := s .ServerCreator .NewServer (userConfig , server.Config {
843
- AllowForkPRsFlag : AllowForkPRsFlag ,
844
- AtlantisURLFlag : AtlantisURLFlag ,
845
- AtlantisVersion : s .AtlantisVersion ,
846
- DefaultTFVersionFlag : DefaultTFVersionFlag ,
847
- RepoConfigJSONFlag : RepoConfigJSONFlag ,
848
- SilenceForkPRErrorsFlag : SilenceForkPRErrorsFlag ,
848
+ AllowForkPRsFlag : AllowForkPRsFlag ,
849
+ AtlantisURLFlag : AtlantisURLFlag ,
850
+ AtlantisVersion : s .AtlantisVersion ,
851
+ DefaultTFDistributionFlag : DefaultTFDistributionFlag ,
852
+ DefaultTFVersionFlag : DefaultTFVersionFlag ,
853
+ RepoConfigJSONFlag : RepoConfigJSONFlag ,
854
+ SilenceForkPRErrorsFlag : SilenceForkPRErrorsFlag ,
849
855
})
850
856
851
857
if err != nil {
@@ -921,8 +927,11 @@ func (s *ServerCmd) setDefaults(c *server.UserConfig, v *viper.Viper) {
921
927
if c .RedisPort == 0 {
922
928
c .RedisPort = DefaultRedisPort
923
929
}
924
- if c .TFDistribution == "" {
925
- c .TFDistribution = DefaultTFDistribution
930
+ if c .TFDistribution != "" && c .DefaultTFDistribution == "" {
931
+ c .DefaultTFDistribution = c .TFDistribution
932
+ }
933
+ if c .DefaultTFDistribution == "" {
934
+ c .DefaultTFDistribution = DefaultTFDistribution
926
935
}
927
936
if c .TFDownloadURL == "" {
928
937
c .TFDownloadURL = DefaultTFDownloadURL
@@ -953,7 +962,7 @@ func (s *ServerCmd) validate(userConfig server.UserConfig) error {
953
962
return fmt .Errorf ("invalid log level: must be one of %v" , ValidLogLevels )
954
963
}
955
964
956
- if userConfig .TFDistribution != TFDistributionTerraform && userConfig .TFDistribution != TFDistributionOpenTofu {
965
+ if userConfig .DefaultTFDistribution != TFDistributionTerraform && userConfig .DefaultTFDistribution != TFDistributionOpenTofu {
957
966
return fmt .Errorf ("invalid tf distribution: expected one of %s or %s" ,
958
967
TFDistributionTerraform , TFDistributionOpenTofu )
959
968
}
@@ -1172,6 +1181,10 @@ func (s *ServerCmd) deprecationWarnings(userConfig *server.UserConfig) error {
1172
1181
// }
1173
1182
//
1174
1183
1184
+ if userConfig .TFDistribution != "" {
1185
+ deprecatedFlags = append (deprecatedFlags , TFDistributionFlag )
1186
+ }
1187
+
1175
1188
if len (deprecatedFlags ) > 0 {
1176
1189
warning := "WARNING: "
1177
1190
if len (deprecatedFlags ) == 1 {
0 commit comments