Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform validate fails: Unsupported block type #93

Closed
1 task done
JorgeRaimundo opened this issue Oct 2, 2023 · 3 comments · Fixed by #94
Closed
1 task done

Terraform validate fails: Unsupported block type #93

JorgeRaimundo opened this issue Oct 2, 2023 · 3 comments · Fixed by #94

Comments

@JorgeRaimundo
Copy link

JorgeRaimundo commented Oct 2, 2023

Description

Hello.

I have the following code:

module "eventbridge" {
  source = "git::https://github.com/terraform-aws-modules/terraform-aws-eventbridge"

  create_bus = false

  rules = {
    crons = {
      description         = "Trigger for the Step Functions"
      schedule_expression = "rate(2 hours)" # Run state machine everyday 2 hours
      # schedule_expression = "rate(5 minutes)"
      # schedule_expression = "cron(0 10 * * ? *)" # Run state machine everyday 10:00 UTC
    },
    uss-health-cron = {
      description         = "Trigger for the USS health checks"
      schedule_expression = "rate(4 hours)"
    }
  }

  targets = {
    crons = [
      {
        name            = aws_sfn_state_machine.iam_integration_state_machine.name
        arn             = aws_sfn_state_machine.iam_integration_state_machine.arn
        attach_role_arn = true
      }
    ],
    uss-health-cron = [
      {
        name  = "USS Health checks target"
        arn   = aws_lambda_function.uss_health_checks.arn
      }
    ]
  }

  sfn_target_arns   = [aws_sfn_state_machine.iam_integration_state_machine.arn]
  attach_sfn_policy = true

  role_name = "iam-integration-event-bridge-role"
  role_tags = local.resource_tags
  create_role = true

  tags = local.resource_tags
}

Since the release of #92 , the validation fails with the following:

╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 640, in resource "aws_pipes_pipe" "this":
│  640:       dynamic "sqs_queue_parameters" {
│
│ Blocks of type "sqs_queue_parameters" are not expected here.
╵
╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 649, in resource "aws_pipes_pipe" "this":
│  649:       dynamic "dynamodb_stream_parameters" {
│
│ Blocks of type "dynamodb_stream_parameters" are not expected here.
╵
╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 671, in resource "aws_pipes_pipe" "this":
│  671:       dynamic "kinesis_stream_parameters" {
│
│ Blocks of type "kinesis_stream_parameters" are not expected here.
╵
╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 700, in resource "aws_pipes_pipe" "this":
│  700:       dynamic "sqs_queue_parameters" {
│
│ Blocks of type "sqs_queue_parameters" are not expected here.
╵
╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 709, in resource "aws_pipes_pipe" "this":
│  709:       dynamic "cloudwatch_logs_parameters" {
│
│ Blocks of type "cloudwatch_logs_parameters" are not expected here.
╵
╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 718, in resource "aws_pipes_pipe" "this":
│  718:       dynamic "lambda_function_parameters" {
│
│ Blocks of type "lambda_function_parameters" are not expected here.
╵
╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 726, in resource "aws_pipes_pipe" "this":
│  726:       dynamic "step_function_state_machine_parameters" {
│
│ Blocks of type "step_function_state_machine_parameters" are not expected
│ here.
╵
╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 734, in resource "aws_pipes_pipe" "this":
│  734:       dynamic "eventbridge_event_bus_parameters" {
│
│ Blocks of type "eventbridge_event_bus_parameters" are not expected here.
╵
╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 746, in resource "aws_pipes_pipe" "this":
│  746:       dynamic "http_parameters" {
│
│ Blocks of type "http_parameters" are not expected here.
╵
╷
│ Error: Unsupported block type
│
│   on .terraform\modules\eventbridge\main.tf line 760, in resource "aws_pipes_pipe" "this":
│  760:   dynamic "enrichment_parameters" {
│
│ Blocks of type "enrichment_parameters" are not expected here.
╵

After pointing the module to v2.3.0 and doing terraform init -upgrade, it validates again.

  • ✋ I have searched the open/closed issues and my issue is not listed.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Module version [Required]: 2.4.0

  • Terraform version: 1.5.7

  • Provider version(s):

    • provider registry.terraform.io/hashicorp/archive v2.4.0
    • provider registry.terraform.io/hashicorp/aws v4.67.0
    • provider registry.terraform.io/hashicorp/random v3.5.1
    • provider registry.terraform.io/hashicorp/template v2.2.0

Reproduction Code [Required]

See code snippet above

Steps to reproduce the behavior:

Not using workspaces

Yes

  • Point the module to the latest version.
  • Do terraform init -upgrade
  • Do terraform validate

Expected behavior

Should state: Success! The configuration is valid.

Actual behavior

See error described above

Terminal Output Screenshot(s)

It's in the description

Additional context

@antonbabenko
Copy link
Member

Thank you for the report!

You have to upgrade the Terraform AWS provider to v5.6.0 (or newer) to be able to use the version 2.4.0 of the module where Pipes were introduced.

I will make a change in the version requirements and make a new release now.

@antonbabenko
Copy link
Member

This issue has been resolved in version 3.0.0 🎉

Copy link

github-actions bot commented Mar 9, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants