mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-12-15 16:09:39 -05:00
cli: manual AWS terraform state transitions
This commit is designed to be reverted in the future (AB#3248). Terraform does not implement moved blocks with dynamic targets: https://github.com/hashicorp/terraform/issues/31335 so we have to migrate the terraform state ourselves.
This commit is contained in:
parent
22ebdace43
commit
3edc1c3ebb
9 changed files with 183 additions and 6 deletions
|
|
@ -153,6 +153,17 @@ func (u *upgradeApplyCmd) migrateTerraform(cmd *cobra.Command, file file.Handler
|
|||
return fmt.Errorf("checking workspace: %w", err)
|
||||
}
|
||||
|
||||
// TODO(AB#3248): Remove this migration after we can assume that all existing clusters have been migrated.
|
||||
var awsZone string
|
||||
if conf.GetProvider() == cloudprovider.AWS {
|
||||
awsZone = conf.Provider.AWS.Zone
|
||||
}
|
||||
manualMigrations := terraformMigrationAWSNodeGroups(conf.GetProvider(), awsZone)
|
||||
for _, migration := range manualMigrations {
|
||||
u.log.Debugf("Adding manual Terraform migration: %s", migration.DisplayName)
|
||||
u.upgrader.AddManualStateMigration(migration)
|
||||
}
|
||||
|
||||
vars, err := parseTerraformUpgradeVars(cmd, conf, fetcher)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing upgrade variables: %w", err)
|
||||
|
|
@ -437,6 +448,7 @@ type cloudUpgrader interface {
|
|||
ApplyTerraformMigrations(ctx context.Context, fileHandler file.Handler, opts upgrade.TerraformUpgradeOptions) error
|
||||
CheckTerraformMigrations(fileHandler file.Handler) error
|
||||
CleanUpTerraformMigrations(fileHandler file.Handler) error
|
||||
AddManualStateMigration(migration terraform.StateMigration)
|
||||
}
|
||||
|
||||
func toPtr[T any](v T) *T {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue