hashicorp / terraform-provider-awscc

Terraform AWS Cloud Control provider
https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
Mozilla Public License 2.0
239 stars 107 forks source link

awscc_mediaconnect_flow_source cannot send max_latency for certain protocols #1860

Open jvascousa opened 3 days ago

jvascousa commented 3 days ago

Community Note

Terraform CLI and Terraform AWS Cloud Control Provider Version

Terraform v1.9.0 on darwin_amd64

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

provider "awscc" {
  region = "us-west-2"

}

resource "awscc_mediaconnect_flow" "emx_flow" {
  name = "emx_flow_terraform"
  source = {
    description    = "source_1"
    name           = "source_1"
    protocol       = "srt-listener"
    ingest_port    = 5001
    max_bitrate    = 20000
    whitelist_cidr = "0.0.0.0/0"
  }

}

# creating the second source. Since it is using srt-listener protocol max_latency is not a valid entry and is omitted from the configuration.
resource "awscc_mediaconnect_flow_source" "source_2" {
  description    = "source_2"
  name           = "source_2"
  protocol       = "srt-listener"
  ingest_port    = 5002
  max_bitrate    = 20000
  whitelist_cidr = "0.0.0.0/0"
  flow_arn       = awscc_mediaconnect_flow.emx_flow.flow_arn
}

Debug Output

https://gist.github.com/jvascousa/0cc01f5c3325e4ea3ebf3b64ffab1c4f

Error: AWS SDK Go Service Operation Incomplete │ │ with awscc_mediaconnect_flow_source.source_2, │ on main.tf line 21, in resource "awscc_mediaconnect_flow_source" "source_2": │ 21: resource "awscc_mediaconnect_flow_source" "source_2" { │ │ Waiting for Cloud Control API service CreateResource operation completion returned: waiter state transitioned to FAILED. │ StatusMessage: Validation failed: │ For Sources that use the SRT Listener protocol, the following fields are invalid: MaxLatency (Service: MediaConnect, │ Status Code: 400, Request ID: 13dd7dd8-a6a2-441f-a6bf-3bd666a463d9). ErrorCode: InvalidRequest

Panic Output

NA

Expected Behavior

resource "awscc_mediaconnect_flow_source" "source_2" should not send max_latency = 2000 as it is not valid when certain protocols are selected. i.e. srt-listener.

There should be a way to not send certain parameters. perhaps when setting a parameter to null. ex. max_latency = null

Actual Behavior

terraform apply below shows max_latency and min_latency are set to 2000 which is not valid for all protocols. i.e. srt-listener. Generating the following error:

Waiting for Cloud Control API service CreateResource operation completion returned: waiter state transitioned to FAILED. │ StatusMessage: Validation failed: │ For Sources that use the SRT Listener protocol, the following fields are invalid: MaxLatency (Service: MediaConnect, │ Status Code: 400, Request ID: f6ee82a2-3735-4e2e-bb8d-5ebf48e7fea6). ErrorCode: InvalidRequest

# awscc_mediaconnect_flow_source.source_2 will be created
  + resource "awscc_mediaconnect_flow_source" "source_2" {
      + decryption              = (known after apply)
      + description             = "source_2"
      + entitlement_arn         = (known after apply)
      + flow_arn                = "arn:aws:mediaconnect:us-west-2:XXXXXXX:flow:1-D1UGAgULDwEPWVdQ-cec310a988e6:emx_flow_terraform"
      + gateway_bridge_source   = (known after apply)
      + id                      = (known after apply)
      + ingest_ip               = (known after apply)
      + ingest_port             = 5002
      + max_bitrate             = 20000
      + max_latency             = 2000
      + min_latency             = 2000
      + name                    = "source_2"
      + protocol                = "srt-listener"
      + sender_control_port     = (known after apply)
      + sender_ip_address       = (known after apply)
      + source_arn              = (known after apply)
      + source_ingest_port      = (known after apply)
      + source_listener_address = (known after apply)
      + source_listener_port    = (known after apply)
      + stream_id               = (known after apply)
      + vpc_interface_name      = (known after apply)
      + whitelist_cidr          = "0.0.0.0/0"
    }

Steps to Reproduce

  1. terraform apply

Important Factoids

References

quixoticmonk commented 3 days ago

Thank you for opening the issue @jvascousa . This does look like the default values on the schema definition here.

Opened an internal ticket to update the defaults similar to the Flow.