logbucket submodule contains provider configuration block
ZeePal opened this issue · comments
TL;DR
Terraform unable to use terraform-google-modules/log-export/google//modules/logbucket
as it now contains provider blocks.
Expected behavior
Existing terraform states applied/planned with release v7.8 to continue working when v7.8.1 was released
Observed behavior
│ Error: Module is incompatible with count, for_each, and depends_on
│
│ on ../../modules/centralized-logging/main.tf line 105, in module "destination_logbucket":
│ 105: count = var.logbucket_options != null ? 1 : 0
│
│ The module at module.logs_export.module.destination_logbucket is a legacy module which contains its own local provider configurations, and so calls to it may not use the count, for_each, or depends_on
│ arguments.
│
│ If you also control the module "registry.terraform.io/terraform-google-modules/log-export/google//modules/logbucket", consider updating this module to instead expect provider configurations to be passed by its
│ caller.
Terraform Configuration
# Source: https://github.com/terraform-google-modules/terraform-example-foundation/blob/d4cb8783e99ce160447663047644b0ce6c4888b0/1-org/modules/centralized-logging/main.tf#L96-L111
module "destination_logbucket" {
source = "terraform-google-modules/log-export/google//modules/logbucket"
version = "~> 7.7"
count = var.logbucket_options != null ? 1 : 0
project_id = var.logging_destination_project_id
name = coalesce(var.logbucket_options.name, local.logging_tgt_name.lbk)
log_sink_writer_identity = module.log_export["${local.value_first_resource}_lbk"].writer_identity
location = var.logbucket_options.location
enable_analytics = var.logbucket_options.enable_analytics
linked_dataset_id = var.logbucket_options.linked_dataset_id
linked_dataset_description = var.logbucket_options.linked_dataset_description
retention_days = var.logbucket_options.retention_days
grant_write_permission_on_bkt = false
}
Terraform Version
Terraform v1.5.7
on linux_amd64
Additional information
I believe this pr/commit is the culprit: https://github.com/terraform-google-modules/terraform-google-log-export/pull/195/files#diff-f783bd693fdc1cfb43bef82e6ae39e95aa7b030c729aa05ac3f72b1511122e04
Workaround:
module "destination_logbucket" {
source = "terraform-google-modules/log-export/google//modules/logbucket"
# version = "~> 7.7" # TODO - Change back after https://github.com/terraform-google-modules/terraform-google-log-export/issues/199 is resolved
version = "= 7.8.0"
thx @apeabody for the fast turn around! <3 I was trying to figure out the intent of #195 to submit a PR without just undoing the change.
Yup, it's needed to fix the CI timeout for google_logging_project_bucket_config
, but should have been put under the CI-example. I'll get 7.8.2
released as soon as the CI is green.