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

r/aws_cloudwatch_event_target - http_target path_parameter_values are treated as a set and not a list #22929

Closed
jvisker opened this issue Feb 3, 2022 · 3 comments · Fixed by #22946
Labels
bug Addresses a defect in current functionality. service/events Issues and PRs that pertain to the events service.
Milestone

Comments

@jvisker
Copy link

jvisker commented Feb 3, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

terraform: 1.1.2
hashicorp/aws: v3.74.0

Affected Resource(s)

  • aws_cloudwatch_event_target

Terraform Configuration Files

terraform {
  required_version = "1.1.2"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "3.74.0"
    }
  }
}

provider "aws" {
  region = "us-west-2"
}

resource "aws_iam_role" "test_http_params" {
  name                 = "test-http-params"

  assume_role_policy = <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "events.amazonaws.com"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
EOF
}

resource "aws_cloudwatch_event_bus" "test_http_params" {
  name = "test-http-params"
}

resource "aws_cloudwatch_event_rule" "test_http_params" {
  name        = "test-http-params"
  description = "test-http-params"
  event_bus_name = aws_cloudwatch_event_bus.test_http_params.name
  event_pattern = jsonencode({
    source      = [{"prefix": "" }]
  })
}

resource "aws_cloudwatch_event_target" "replication" {
  rule           = aws_cloudwatch_event_rule.test_http_params.name
  event_bus_name = aws_cloudwatch_event_bus.test_http_params.name
  arn            = aws_cloudwatch_event_api_destination.test_http_params.arn
  role_arn       = aws_iam_role.test_http_params.arn
  http_target {
    path_parameter_values = ["param", "param"]
  }
}

resource "aws_cloudwatch_event_connection" "test_http_params" {
  name               = "test_http_params"
  description        = "test"
  authorization_type = "BASIC"

  auth_parameters {
    basic {
      username = "user"
      password = "notarealpassword"
    }
  }
}

resource "aws_cloudwatch_event_api_destination" "test_http_params" {
  name                             = "test_http_params"
  description                      = "An API Destination"
  invocation_endpoint              = "https://fakewebsite.com/*/events/*"
  http_method                      = "POST"
  connection_arn                   = aws_cloudwatch_event_connection.test_http_params.arn
}

Expected Behavior

When http path parameters are used for the aws_cloudwatch_event_target resource they should be treated as an ordered list.

Actual Behavior

The http path parameters are treated as an unordered set which causes duplicate values to be removed and value ordering to be arbitrary. In the example provided there should be a list of two path parameters (params and params). However, the resource is only built with one because a set cannot have duplicate values. Additionally the order specified by the terraform configuration may be changed based upon the internal implementation of the set.

Steps to Reproduce

  1. terraform apply
  2. Note that the target PathParameterValues only show one value instead of the two it should.

Note

The schema here shows the path parameters defined as a TypeSet instead of a TypeList:

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/events Issues and PRs that pertain to the events service. service/iam Issues and PRs that pertain to the iam service. labels Feb 3, 2022
@jvisker
Copy link
Author

jvisker commented Feb 3, 2022

This bug essentially renders this feature useless through terraform.

@DrFaust92 DrFaust92 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. service/iam Issues and PRs that pertain to the iam service. labels Feb 4, 2022
@github-actions github-actions bot added this to the v4.0.0 milestone Feb 4, 2022
@github-actions
Copy link

This functionality has been released in v4.0.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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 May 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/events Issues and PRs that pertain to the events service.
Projects
None yet
2 participants