Hello.
We are running terraform 0.12.7 with version 2.13.0 for all the google providers.
I have a situation where each time i do a terraform plan/apply it shows the same resource needs to be updated even though the update writes the same value each time. (as verified via getting the runtime config variable via gcloud).
My terraform plan/apply output
Terraform will perform the following actions:
# module.examplecorp-uat.google_runtimeconfig_variable.data_transfer_account will be updated in-place
~ resource "google_runtimeconfig_variable" "data_transfer_account" {
id = "projects/examplecorp-uat-pipeline-XXXX/configs/network-runtime-config/variables/examplecorp/infra/data-transfer-account"
name = "examplecorp/infra/data-transfer-account"
parent = "network-runtime-config"
project = "examplecorp-uat-pipeline-XXXX"
~ text = "serviceAccount:project-XXXXXXXXXXX@storage-transfer-service.iam.gserviceaccount.com" -> (known after apply)
update_time = "2019-08-08T20:35:40.457462484Z"
}
# module.examplecorp-uat.module.data_transfer_project.data.google_storage_transfer_project_service_account.storage_transfer_sa will be read during apply
# (config refers to values not yet known)
<= data "google_storage_transfer_project_service_account" "storage_transfer_sa" {
+ email = (known after apply)
+ id = (known after apply)
+ project = "examplecorp-uat-data-transfer-XXXX"
}
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.examplecorp-uat.module.data_transfer_project.data.google_storage_transfer_project_service_account.storage_transfer_sa: Refreshing state...
The associated resource declaration is
resource "google_runtimeconfig_variable" "data_transfer_account" {
parent = google_runtimeconfig_config.environment_config.name
name = "examplecorp/infra/data-transfer-account"
text = module.data_transfer_project.data_transfer_service_account
project = module.data_pipeline_project.project_id
}
The text parameter is consuming the following output
output "data_transfer_service_account" {
description = "the data transfer service account"
value = "serviceAccount:${data.google_storage_transfer_project_service_account.storage_transfer_sa.email}"
}
We have many other runtime configs that get updated 1 time and do not show up in a diff unless they are changed. Only the one that continually has a diff relies on a data source (https://www.terraform.io/docs/providers/google/d/google_storage_transfer_project_service_account.html). I’m thinking that this is the problem but not sure how to go about retrieving the service account name in a different fashion.
This link https://www.terraform.io/docs/configuration/data-sources.html#data-resource-behavior seems to imply to me that for whatever reason this particular resource cannot be retrieved during the plan phase and is why i keep getting the situation where terraform thinks a change is needed.
Any tips on how to change things so terraform knows that no change is actually needed?
TIA.