0
votes

I have been trying to update some of the terraform scripts from version 0.6.13 to 0.9.6. In my scripts I had before

     terraform remote config -backend=s3 \
      -backend-config="bucket=my_bucker" \
      -backend-config="access_key=my_access_key" \
      -backend-config="secret_key=my_secret" \
      -backend-config="region=my_region" \
      -backend-config="key=my_state_key"

and then

     terraform/terraform remote pull

Which was pulling the remote state from aws. Upon running terraform apply it will give me the exact resources that needed to be updated/ created based on the remote tfstate that is stored in an s3 bucket.

Now the issue I'm facing is that remote pull and remote config commands are outdated and don't work anymore.

I tried to follow the instructions on https://www.terraform.io/docs/backends/types/remote.html however it was not much helpful.

From what I understand I would have to do an init first with a partial configuration which presumably would automatically pull the remote state as following:

`terraform init -var-file="terraform.tfvars"\
 -backend=true \
 -backend-config="bucket=my_bucker" \
  -backend-config="access_key=my_access_key" \
  -backend-config="secret_key=my_secret" \
  -backend-config="region=my_region" \
  -backend-config="key=my_state_key"`

However it doesn't really pull the remote state as it was doing before.

Would anyone be able to guide me into the right direction?

2

2 Answers

1
votes

You don't need terraform remote pull any more. Terraform by default will automatically based on the refresh flag which defaults to true.

0
votes

Apparently I had to add a minimal backend configuration such as

terraform {
  backend "s3" {
  }
}

in my main.tf file for it to work