tofu-controller icon indicating copy to clipboard operation
tofu-controller copied to clipboard

import initial tfstate with a secret

Open chanwit opened this issue 2 years ago • 2 comments

We currently could do the following to import a TFSTATE for a specify Terraform object.

gzip terraform.tfstate

NAME=tf-controller-ng-cc5a1ac4
kubectl create secret \
  generic tfstate-default-${NAME} \
  --from-file=tfstate=terraform.tfstate.gz \
  --dry-run=client -o=yaml \
  yq e '.metadata.annotations["encoding"]="gzip"' - > tfstate-default-${NAME}.yaml
  
kubectl apply -f tfstate-default-${NAME}.yaml

Need a good UX / design / approach to tackle this feature.

chanwit avatar Jan 08 '22 16:01 chanwit

A CLI for this would be nice to have

chanwit avatar Jan 23 '22 16:01 chanwit

would this make sense to be added to tfctl? both for downloading and uploading the state

elisiano avatar Aug 17 '22 18:08 elisiano