mirror of https://github.com/databricks/cli.git
respect --force flag
This commit is contained in:
parent
6ecf48e163
commit
7d2d522497
|
@ -37,13 +37,15 @@ func (s *statePush) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostic
|
||||||
}
|
}
|
||||||
defer local.Close()
|
defer local.Close()
|
||||||
|
|
||||||
state, err := local.Stat()
|
if !b.Config.Bundle.Force {
|
||||||
if err != nil {
|
state, err := local.Stat()
|
||||||
return diag.FromErr(err)
|
if err != nil {
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
if state.Size() > MaxStateFileSize {
|
if state.Size() > MaxStateFileSize {
|
||||||
return diag.Errorf("Deployment state file size exceeds the maximum allowed size of %d bytes. Please reduce the number of resources in your bundle and/or split your bundle into multiple.", MaxStateFileSize)
|
return diag.Errorf("Deployment state file size exceeds the maximum allowed size of %d bytes. Please reduce the number of resources in your bundle, split your bundle into multiple or re-run the command with --force flag.", MaxStateFileSize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof(ctx, "Writing local deployment state file to remote state directory")
|
log.Infof(ctx, "Writing local deployment state file to remote state directory")
|
||||||
|
|
|
@ -47,13 +47,15 @@ func (l *statePush) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostic
|
||||||
}
|
}
|
||||||
defer local.Close()
|
defer local.Close()
|
||||||
|
|
||||||
state, err := local.Stat()
|
if !b.Config.Bundle.Force {
|
||||||
if err != nil {
|
state, err := local.Stat()
|
||||||
return diag.FromErr(err)
|
if err != nil {
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
if state.Size() > deploy.MaxStateFileSize {
|
if state.Size() > deploy.MaxStateFileSize {
|
||||||
return diag.Errorf("Terraform state file size exceeds the maximum allowed size of %d bytes. Please reduce the number of resources in your bundle and/or split your bundle into multiple.", deploy.MaxStateFileSize)
|
return diag.Errorf("Terraform state file size exceeds the maximum allowed size of %d bytes. Please reduce the number of resources in your bundle, split your bundle into multiple or re-run the command with --force flag", deploy.MaxStateFileSize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upload state file from local cache directory to filer.
|
// Upload state file from local cache directory to filer.
|
||||||
|
|
Loading…
Reference in New Issue