0
votes

terraform docs recommend to specify provider version to avoid breaking changes. what does the breaking changes mean here?

does breaking changes mean the terraform plan shows delete and recreate of resources due to auto provider version upgrade on terraform init

lets say i have my provider terraform block as below where i did not set the version constraint

provider "aws" {
  region                  = "us-west1"
  shared_credentials_file = "/home/ubuntu/.aws/credentials"
  profile                 = "default"
}

now lets say i have run terraform apply and created the infra lets consider the aws plugin version is 2.0.0 at this time.

lets say after a month i have cloned the repo and did terraform init now lets say the aws plugin version is 4.0.0 since latest version is fetched as there is no version constraint

now is there a chance that terraform plan might cause a modify resource config OR delete and recreate OR destroy of existing resources due to this auto plugin version upgrade to version 4.0.0 but previously i have used 2.0.0.

1
It's basically undefined what may happen and this is dependent on the actual provider and release. Normally it will be that some resource configuration has changed so that they no longer take old parameters and will error or that previously defaulted things are no longer defaulted. But it could also be that a change would cause a resource to be destroyed and recreated without any change in the user's configuration and the upgrade guide would provide a path to avoiding it. But it's much more likely to be just configuration changes that will error if you use old config.ydaetskcoR

1 Answers

1
votes

Update: Possible, but unlikely.
Recreation: Possible, but even less likely.
Deletion: I don't think so.

The most likely thing that is going to happen is that your terraform plan or terraform apply will fail since some resource attribute that you specify is no longer supported by the provider, or it requires a new attribute that you do not set, or the resource was removed entirely, or some of the outputs you use changed, etc...

This just happened to us in regards to the region attribute of the aws_s3_bucket, we specified it, the provider got updated and the plan failed because you were no longer allowed to specify a region explicitly.