cloud: DetectConfigChangeType helper

This aims to encapsulate the somewhat-weird logic we currently use to
distinguish between the various "terraform init" situations involving
Terraform Cloud mode, in the hope of making codepaths that branch based
on this slightly easier to read.

This isn't yet used, but uses of it will follow in subsequent commits.
This commit is contained in:
Martin Atkins
2021-11-12 15:17:27 -08:00
parent 8f97992db1
commit e5172fea95
3 changed files with 281 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
// Code generated by "stringer -type ConfigChangeMode"; DO NOT EDIT.
package cloud
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[ConfigMigrationIn-8600]
_ = x[ConfigMigrationOut-8598]
_ = x[ConfigChangeInPlace-8635]
_ = x[ConfigChangeIrrelevant-129335]
}
const (
_ConfigChangeMode_name_0 = "ConfigMigrationOut"
_ConfigChangeMode_name_1 = "ConfigMigrationIn"
_ConfigChangeMode_name_2 = "ConfigChangeInPlace"
_ConfigChangeMode_name_3 = "ConfigChangeIrrelevant"
)
func (i ConfigChangeMode) String() string {
switch {
case i == 8598:
return _ConfigChangeMode_name_0
case i == 8600:
return _ConfigChangeMode_name_1
case i == 8635:
return _ConfigChangeMode_name_2
case i == 129335:
return _ConfigChangeMode_name_3
default:
return "ConfigChangeMode(" + strconv.FormatInt(int64(i), 10) + ")"
}
}