Open norbertcyran opened 2 months ago
It looks like a bug in the provider code. The issue will be forwarded to the service team to fix.
kms_key_name
can be modified. If yes, kms_key_name
should not have ForceNew: true
. bigquery_destination_config
should have ForceNew: true
.Confirmed issue!
It isn't possible to change other properties in the block code bigquery_destination_config
other than kms_key_name
and data_freshness
. After trying to apply changes terraform returns the next message:
Error: Error updating Stream "<redacted>": googleapi: Error 400: Only
kms_key_nameand
data_freshnesscan be modified for BigQuery destination config.
In both Terraform registry and Google Cloud documentation it is not specified that this change is not possible.
To test it, there was tried to change the first block of code for the second:
Original:
bigquery_destination_config {
single_target_dataset {
dataset_id = google_bigquery_dataset.bq_ds_18644.id
}
data_freshness = "900s"
}
Changed code:
bigquery_destination_config {
source_hierarchy_datasets {
dataset_template {
location = "us-central1"
dataset_id_prefix = "myprefix"
}
}
data_freshness = "900s"
}
Community Note
Terraform Version & Provider Version(s)
Terraform v0.13 on Linux
Affected Resource(s)
google_datastream_stream
Expected Behavior
When editing most of
bigquery_destination_config
fields (e.g.source_hierarchy_datasets.dataset_template.dataset_id_prefix
), stream should be recreated, as those fields are immutableActual Behavior
terraform apply
fails withError: Error updating Stream "<redacted>": googleapi: Error 400: Only `kms_key_name` and `data_freshness` can be modified for BigQuery destination config.
Steps to reproduce
bigquery_destination_config
, for examplesource_hierarchy_datasets.dataset_template.dataset_id_prefix
terraform apply
Additional information
https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/datastream/resource_datastream_stream.go#L143 we can see that
ForceNew
is missing from most of the fields in BQ destination config, exceptkms_key_name
, which, according to the error message from the API, is one of the two fields allowed to changeWorkaround available: tainting the resource
b/352330060