LoginSignup
0
0

More than 1 year has passed since last update.

aws_lb_listener_rule の redirect host で InvalidLoadBalancerAction

Posted at

背景

Terraform のリスナールールでリダイレクトを設定しようとしたところ、以下のようなエラーが出た。

Error: Error creating LB Listener Rule: InvalidLoadBalancerAction: he Host parameter must be a valid hostname and may contain up to one of each of these placeholders: '#{host}'.

原因

いくつか考えられるが、ここではリダイレクト先ホスト名にアンダースコアが使われていたのが原因だった。
アンスコの代わりにハイフンを用いたら解消した。

備考

アンダースコアはホスト名的には NG

RFC 的にも禁止されている模様。

しかし、Route53 レコードを作成することは可能。リソースによってバリデーションが厳しかったり緩かったりしているのかもしれない。

  # aws_route53_record.this will be created
  + resource "aws_route53_record" "this" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "foo_bar.baz.com"
      + type            = "A"
      + zone_id         = "***"
            :
    }
  :
aws_route53_record.this: Creation complete after 35s [id=***_A]
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0