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

Not able to use valid FQDN as namespace in app mesh virtual nodes #9764

Closed
gdowmont opened this issue Aug 14, 2019 · 8 comments · Fixed by #9788
Closed

Not able to use valid FQDN as namespace in app mesh virtual nodes #9764

gdowmont opened this issue Aug 14, 2019 · 8 comments · Fixed by #9788
Labels
bug Addresses a defect in current functionality. service/appmesh Issues and PRs that pertain to the appmesh service.
Milestone

Comments

@gdowmont
Copy link

gdowmont commented Aug 14, 2019

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 "me too" comments, 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 Version

Terraform v0.11.14

  • provider.aws v2.23.0

Affected Resource(s)

  • aws_appmesh_virtual_node

Terraform Configuration Files

resource "aws_appmesh_virtual_node" "virtual_node_blue" {
  name      = "${var.service_name}-blue"
  mesh_name = "${data.terraform_remote_state.service_mesh.mesh_id}"

  spec {
    listener {
      port_mapping {
        port     = "${var.service_port}"
        protocol = "http"
      }

      health_check {
        protocol            = "http"
        port                = "${var.service_port}"
        path                = "/api/home"
        unhealthy_threshold = 10
        healthy_threshold   = 2
        timeout_millis      = 2000
        interval_millis     = 5000
      }
    }

    service_discovery {
      aws_cloud_map {
        attributes = {
          ECS_TASK_DEFINITION_FAMILY = "${var.environment}-${var.service_name}-blue"
        }

        service_name   = "${var.service_name}"
        namespace_name = "example.domain.com"
      }
    }
  }
}

Debug Output

Error: Error running plan: 1 error occurred:
        * module.nginx_two.aws_appmesh_virtual_node.virtual_node_green: only alphanumeric characters, underscores and hyphens allowed in "spec.0.service_discovery.0.aws_cloud_map.0.namespace_name"

Panic Output

Expected Behavior

Setting this value through AWS Console is accepted so this also should be allowed through terraform.

Actual Behavior

Validation does not allow dots (.) in the namespace name

Steps to Reproduce

Setup an app mesh virtual node with cloud map discovery and FQDN as namespace name.

  1. terraform apply

Important Factoids

Validator validateServiceDiscoveryHttpNamespaceName does not allow dot (.) in regex. See https://github.com/terraform-providers/terraform-provider-aws/blob/c8049b7ba6b8a9a999966f76d6899ea0a6322a18/aws/validators.go#L2252-L2257

References

  • #0000
@ghost ghost added the service/appmesh Issues and PRs that pertain to the appmesh service. label Aug 14, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 14, 2019
@ewbankkit
Copy link
Contributor

The API documentation says the pattern is:

((?=^.{1,127}$)^([a-zA-Z0-9_][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9_]|[a-zA-Z0-9])(.([a-zA-Z0-9_][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9_]|[a-zA-Z0-9]))*$)|(^.$)

Given that these regexes are in Java format and don't easily translate to Go format, I'll change this to just a 1-1024 length check (which is all the corresponding Cloud Map API specifies).

@gdowmont
Copy link
Author

@ewbankkit Thanks for looking into it. That would definitely fix my issue.

@tomaszdudek7
Copy link

tomaszdudek7 commented Oct 18, 2019

Is there any way to ignore this check for now?

@ewbankkit
Copy link
Contributor

@spaszek No, we'll need #9788 merged I think.

@bflad
Copy link
Contributor

bflad commented Nov 20, 2019

Regarding potential enhancements to ignoring validation, please see hashicorp/terraform-plugin-sdk#105

@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 20, 2019
@bflad bflad added this to the v2.39.0 milestone Nov 20, 2019
@bflad
Copy link
Contributor

bflad commented Nov 20, 2019

The fix for this has been merged and will release with version 2.39.0 of the Terraform AWS Provider, likely tomorrow. Thanks to @ewbankkit for the implementation. 👍

@ghost
Copy link

ghost commented Nov 21, 2019

This has been released in version 2.39.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 for triage. Thanks!

@ghost
Copy link

ghost commented Mar 29, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
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/appmesh Issues and PRs that pertain to the appmesh service.
Projects
None yet
4 participants