LoginSignup
1
1

More than 3 years have passed since last update.

terraformの勉強記録

Last updated at Posted at 2019-08-11

Pragmatic Terraformの写経をしていた。
7章と8章を書いて、 terraform applyしたら以下のエラーが出た。

Error: Error creating LB Listener: CertificateNotFound: Certificate 'arn:aws:acm:ap-northeast-1:882275384674:certificate/8f385a88-7438-44a1-b9ac-4d95a0c1acca' not found
        status code: 400, request id: 04759268-bc20-11e9-8e88-d92bcd313ecb

  on alb.tf line 102, in resource "aws_lb_listener" "https":
 102: resource "aws_lb_listener" "https" {



Error: Invalid index

  on route53.tf line 25, in resource "aws_route53_record" "example_certificate":
  25:   name    = aws_acm_certificate.example.domain_validation_options[0].resource_record_name
    |----------------
    | aws_acm_certificate.example.domain_validation_options is empty list of object

The given key does not identify an element in this collection value.


Error: Invalid index

  on route53.tf line 26, in resource "aws_route53_record" "example_certificate":
  26:   type    = aws_acm_certificate.example.domain_validation_options[0].resource_record_type
    |----------------
    | aws_acm_certificate.example.domain_validation_options is empty list of object

The given key does not identify an element in this collection value.


Error: Invalid index

  on route53.tf line 27, in resource "aws_route53_record" "example_certificate":
  27:   records = [aws_acm_certificate.example.domain_validation_options[0].resource_record_value]
    |----------------
    | aws_acm_certificate.example.domain_validation_options is empty list of object

The given key does not identify an element in this collection value.

SSLのDNS検証用のレコード作成に失敗している。そのため、ALBのhttpsリスナーの作成も失敗している。(httpsリスナーの作成にはssl証明書が必要)

タイポしてるのかと思ったけど、特にタイポもしていなかった。
よくわからないので、再度 terraform apply したらなんか作成できた。

検証用のCNAMEレコードがちゃんと作成されていて、
スクリーンショット_2019-08-11_19_38_03.png

証明書も発行済みになっている。
スクリーンショット 2019-08-11 19.41.50.png

あと、route53のレコードセットにCNAMEレコードが表示されるのが微妙に時間がかかった(5分くらい)
ACMの方では証明書が発行済になっているのにroute53の方にはCNAMEレコードが存在しなかったから、「なんで発行済になれた?」と思ったが、時間が解決してくれた。

1
1
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
1
1