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

Terraform 0.11.3 crash during apply #17574

Closed
nicwise opened this issue Mar 13, 2018 · 2 comments
Closed

Terraform 0.11.3 crash during apply #17574

nicwise opened this issue Mar 13, 2018 · 2 comments

Comments

@nicwise
Copy link

nicwise commented Mar 13, 2018

Terraform Version

terraform -v
Terraform v0.11.3
+ provider.aws v1.11.0

Terraform Configuration Files

resource "aws_s3_bucket" "static_bucket" {
  bucket = "xx-${var.environment}-static-site"
  acl    = "public-read"

  website {
    index_document = "index.html"
  }

  tags {
    Name        = "xx-${var.environment}-static-site"
    Environment = "${var.environment}"
  }


}

output bucket_domain_name {
  value = "${aws_s3_bucket.static_bucket.website_domain}"
}



resource "aws_cloudfront_distribution" "static_site_distribution" {

  enabled = true
  #origin for static content
  origin {
    domain_name = "${var.static_content_bucket_domain}" #web url of the bucket
    origin_id   = "${var.origin_id}_static"

    s3_origin_config {
      origin_access_identity = ""
    }
  }

  default_cache_behavior {
    allowed_methods  = ["GET", "HEAD"]
    cached_methods   = ["GET", "HEAD"]
    target_origin_id = "${var.origin_id}_static"
    compress         = true

    forwarded_values {
      query_string = true

      cookies {
        forward = "all"
      }
    }

    viewer_protocol_policy = "redirect-to-https"
    min_ttl                = 0
    default_ttl            = 0
    max_ttl                = 0
  }



  price_class = "PriceClass_100"

  restrictions {
    geo_restriction {
      restriction_type = "none"
    }
  }

  viewer_certificate {
    cloudfront_default_certificate = true
    minimum_protocol_version       = "TLSv1"
  }

  tags {
    Name        = "${var.environment}-${var.role_name}"
    Environment = "${var.environment}"
    App         = "${var.role_name}"
  }
}

Debug Output

Crash Output

Error: Error applying plan:

1 error(s) occurred:

  • module.cloudfront.aws_cloudfront_distribution.static_site_distribution: aws_cloudfront_distribution.static_site_distribution: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.

Please include the following information in your report:

    Terraform Version: 0.11.3
    Resource ID: aws_cloudfront_distribution.static_site_distribution
    Mismatch reason: attribute mismatch: origin.3487601949.custom_header.#
    Diff One (usually from plan): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"origin.714713060.origin_id":*terraform.ResourceAttrDiff{Old:"staticcontent_static", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.custom_header.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.custom_origin_config.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.3487601949.s3_origin_config.#":*terraform.ResourceAttrDiff{Old:"0", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.domain_name":*terraform.ResourceAttrDiff{Old:"xx-wordpress-static-site.s3.amazonaws.com", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.origin_path":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.3487601949.custom_header.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.3487601949.custom_origin_config.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.s3_origin_config.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.3487601949.s3_origin_config.2547889144.origin_access_identity":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.3487601949.domain_name":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.3487601949.origin_id":*terraform.ResourceAttrDiff{Old:"", New:"staticcontent_static", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.3487601949.origin_path":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, Meta:map[string]interface {}(nil)}
    Diff Two (usually from apply): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"origin.4033925426.domain_name":*terraform.ResourceAttrDiff{Old:"", New:"s3-website-us-west-2.amazonaws.com", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.s3_origin_config.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.custom_origin_config.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.custom_header.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.4033925426.s3_origin_config.2547889144.origin_access_identity":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.origin_path":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.4033925426.custom_header.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.4033925426.origin_path":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.domain_name":*terraform.ResourceAttrDiff{Old:"xx-wordpress-static-site.s3.amazonaws.com", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.4033925426.s3_origin_config.#":*terraform.ResourceAttrDiff{Old:"0", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.714713060.origin_id":*terraform.ResourceAttrDiff{Old:"staticcontent_static", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.4033925426.custom_origin_config.#":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "origin.4033925426.origin_id":*terraform.ResourceAttrDiff{Old:"", New:"staticcontent_static", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, Meta:map[string]interface {}(nil)}

Also include as much context as you can about your config, state, and the steps you performed to trigger this error.

Expected Behavior

plan should have applied

Actual Behavior

Crash

Steps to Reproduce

This is the original plan

Terraform will perform the following actions:

  ~ module.cloudfront.aws_cloudfront_distribution.static_site_distribution
      origin.3487601949.custom_header.#:                                    "0" => "0"
      origin.3487601949.custom_origin_config.#:                             "0" => "0"
      origin.3487601949.domain_name:                                        "" => ""
      origin.3487601949.origin_id:                                          "" => "staticcontent_static"
      origin.3487601949.origin_path:                                        "" => ""
      origin.3487601949.s3_origin_config.#:                                 "0" => "1"
      origin.3487601949.s3_origin_config.2547889144.origin_access_identity: "" => ""
      origin.714713060.custom_header.#:                                     "0" => "0"
      origin.714713060.custom_origin_config.#:                              "0" => "0"
      origin.714713060.domain_name:                                         "xx-wordpress-static-site.s3.amazonaws.com" => ""
      origin.714713060.origin_id:                                           "staticcontent_static" => ""
      origin.714713060.origin_path:                                         "" => ""
      origin.714713060.s3_origin_config.#:                                  "0" => "0"

  ~ module.s3.aws_s3_bucket.static_bucket
      website.#:                                                            "0" => "1"
      website.0.index_document:                                             "" => "index.html"

I had changed the domain name (it's ment to the website domain of the static bucket, but it looks like it's come in blank).

Additional Context

Very basic Cloudfront -> S3 setup.

References

@ghost
Copy link

ghost commented Mar 13, 2018

This issue has been automatically migrated to hashicorp/terraform-provider-aws#3766 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-aws#3766.

@ghost ghost closed this as completed Mar 13, 2018
@ghost
Copy link

ghost commented Apr 4, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants