Panfactum / stack

The Panfactum Stack
https://panfactum.com
Other
14 stars 5 forks source link

[Bug]: cannot rerun pf-env-bootstrap if failure occurs after tf state is created #154

Closed uptownhr closed 2 weeks ago

uptownhr commented 2 weeks ago

Prior Search

What happened?

I ran pf-env-bootstrap and the tf state successfully got applied but failed when attempting to apply sops module. Attempting to rerun the command fails mentioning that state must be removed before continuing

Steps to Reproduce

  1. follow guide up to bootstrapping iac
  2. select an environment and run pf-env-bootstrap
  3. due to bug https://github.com/Panfactum/stack/issues/153 sops will fail to deploy
  4. try running pf-env-bootstrap again

Relevant log output

data.aws_iam_policy_document.state: Read complete after 0s [id=2525299931]
╷
│ Error: Resource already managed by OpenTofu
│ 
│ OpenTofu is already managing a remote object for aws_s3_bucket.state. To
│ import to this address you must first remove the existing object from the
│ state.
╵

ERRO[0006] tofu invocation failed in /Users/james/Projects/selflessly/infrastructure/.terragrunt-cache/hH-OD6pytOyZ3NUiCBxmgxPcJYs/jefY46BK7z-2whPUMHguV-9ROrg/packages/infrastructure/tf_bootstrap_resources  error=[/Users/james/Projects/selflessly/infrastructure/.terragrunt-cache/hH-OD6pytOyZ3NUiCBxmgxPcJYs/jefY46BK7z-2whPUMHguV-9ROrg/packages/infrastructure/tf_bootstrap_resources] exit status 1 prefix=[/Users/james/Projects/selflessly/infrastructure/environments/production/global/tf_bootstrap_resources] 
ERRO[0006] 1 error occurred:
    * [/Users/james/Projects/selflessly/infrastructure/.terragrunt-cache/hH-OD6pytOyZ3NUiCBxmgxPcJYs/jefY46BK7z-2whPUMHguV-9ROrg/packages/infrastructure/tf_bootstrap_resources] exit status 1
fullykubed commented 2 weeks ago

Fixed.