Terraform Version: 1.1.0 and 1.2.0 both have same issues
Initially, I ran terraform plan with “target” command to avoid duplicate resource creation , but it really messed up my state files afterwards in backend config.
Command - Terraform plan -target=module.eks.aws_eks_cluster.this
When i run terraform apply , it was clearly not adding any changes. In fact, it created a new state file with apply command and updated the backend with new broken state file.
From what i understood the terraform plan document here Command: plan | Terraform by HashiCorp - the “target command can cause a drift in my configuration”
Later, I have followed the “[managing drift state]
(Manage Resource Drift | Terraform - HashiCorp Learn)” steps as mentioned there, i am able to do the -refresh-only option successfully for both and apply.
I thought that would resolve my problem, but when i try to run the terraform apply, it’s not applying no changes and creating a broken state file again in my backend config.
Any help would be greatly appreciated !! Thank you.