Pydam
Pydam

Reputation: 129

Terraform google_logging_project_sink 'Exclusions' unknown block type

I'm running the latest google provider and trying to use the example terraform registry code to create a log sink. However the exclusion block is unrecognized

I keep getting 'An argument named "exclusions" is not expected here'

Any ideas on where I am going wrong?


resource "google_logging_project_sink" "log-bucket" {
  name        = "my-logging-sink"
  destination = "logging.googleapis.com/projects/my-project/locations/global/buckets/_Default"

  exclusions {
        name = "nsexcllusion1"
        description = "Exclude logs from namespace-1 in k8s"
        filter = "resource.type = k8s_container resource.labels.namespace_name=\"namespace-1\" "
    }

    exclusions {
        name = "nsexcllusion2"
        description = "Exclude logs from namespace-2 in k8s"
        filter = "resource.type = k8s_container resource.labels.namespace_name=\"namespace-2\" "
    }

  unique_writer_identity = true

Showing that the version of Google provider is at the stated version in the comment below

$ terraform version
Terraform v0.12.29
+ provider.datadog v2.21.0
+ provider.google v3.44.0
+ provider.google-beta v3.57.0

Update: Have also tried 0.14 of Terraform and that makes no difference.


Error: Unsupported block type

  on ..\..\..\..\modules\krtyen\datadog\main.tf line 75, in module "export_logs_to_datadog_log_sink":
  75:     exclusions {

Blocks of type "exclusions" are not expected here.

Releasing state lock. This may take a few moments...
[terragrunt] 2021/02/22 11:11:20 Hit multiple errors:
exit status 1

Upvotes: 0

Views: 991

Answers (1)

Marcin
Marcin

Reputation: 238081

You have to upgrade you google provided. exclusions block has been added in version v3.44.0:

logging: Added support for exclusions options for google_logging_project_sink

Upvotes: 1

Related Questions