terraform-aws-modules/terraform-aws-apigateway-v2

stage_domain_name output for websocket api returns wss protocol and stage_id

acormier-maia opened this issue · 4 comments

Description

When creating a websocket API, the output stage_domain_name contains the wss:// protocol and the stage_id prefix. This is due to the regex in the output value not matching the wss protocol.

  • ✋ 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]: 5.0.0

  • Terraform version:
    Terraform v1.7.5

  • Provider version(s):

  • provider registry.terraform.io/hashicorp/aws v5.54.1
  • provider registry.terraform.io/hashicorp/external v2.3.3
  • provider registry.terraform.io/hashicorp/local v2.5.1
  • provider registry.terraform.io/hashicorp/null v3.2.2
  • provider registry.terraform.io/hashicorp/random v3.6.2
  • provider registry.terraform.io/integrations/github v6.2.3

Reproduction Code [Required]

module "api_gateway" {
  source  = "terraform-aws-modules/apigateway-v2/aws"
  version = "5.0.0"

  name          = "websocket"
  description   = "Websocket API"
  protocol_type = "WEBSOCKET"
  route_selection_expression = "$request.body.action"

  create_domain_name = false

  stage_name = "ws-router"

  stage_default_route_settings = {
    logging_level            = "INFO"
  }

  routes = {
    "$connect" = {
      operation_name = "ConnectRoute"

      integration = {
        uri = var.websocket_connect_fn_arn
      }
    }
  }
}

output "stage_domain_name" {
    value = module.api_gateway.stage_domain_name
}

Steps to reproduce the behavior:

Run Terraform apply,

Expected behavior

Should only be the domain name.

Actual behavior

The stage_domain_name output starts with the wss:// protocol and ends with the stage_id.

what is the use case for this?

I need to pass the domain name into Cloudfront. This way we have a single domain name which proxies S3, API Gateway. I am putting up a PR now.

This issue has been resolved in version 5.1.3 🎉