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

aws_cloudfront_distribution resource creation panics on empty value in restriction_type #10668

Closed
mrf opened this issue Oct 29, 2019 · 3 comments
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/cloudfront Issues and PRs that pertain to the cloudfront service. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@mrf
Copy link

mrf commented Oct 29, 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.12.12

  • provider.aws v2.33.0

Affected Resource(s)

  • aws_cloudfront_distribution

Terraform Configuration Files

resource "aws_s3_bucket" "my_bucket" {
  bucket = "testing-terraform-provider-my-bucket"
  acl = "private"
}

resource "aws_cloudfront_distribution" "s3_distribution" {
	origin {
		domain_name = "${aws_s3_bucket.my_bucket.id}.s3.amazonaws.com"
		origin_id = "myS3Origin"
	}
	enabled = true
	default_root_object = "index.html"
	default_cache_behavior {
		allowed_methods = [ "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT" ]
		cached_methods = [ "GET", "HEAD" ]
		target_origin_id = "myS3Origin"
		forwarded_values {
			query_string = false
			cookies {
				forward = "none"
			}
		}
		viewer_protocol_policy = "allow-all"
		min_ttl = 0
		default_ttl = 3600
		max_ttl = 86400
	}
	price_class = "PriceClass_200"
	restrictions {
		geo_restriction {
			restriction_type = ""
		}
	}
	viewer_certificate {
		cloudfront_default_certificate = true
	}
	tags = {
            environment = "production"
            account = "main"
	}
}

Debug Output

https://gist.github.com/mrf/acf495ff2ec424d404c56537f18a581f

Panic Output

https://gist.github.com/mrf/03f3095bd71f658c0f3be2064deda693

Expected Behavior

I should see an error message letting me know that restriction_type cannot be empty.

Actual Behavior

aws_cloudfront_distribution.cdn-distribution: Creating...

Error: rpc error: code = Unavailable desc = transport is closing

Steps to Reproduce

  1. Edit restrictions block in resource to have empty value for restriction_type. Used test resource testAccAWSCloudFrontDistributionS3ConfigWithTags from acceptance tests in above example.
  2. terraform plan
  3. terraform apply
@ghost ghost added service/cloudfront Issues and PRs that pertain to the cloudfront service. service/s3 Issues and PRs that pertain to the s3 service. labels Oct 29, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 29, 2019
@ryndaniels ryndaniels added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 4, 2019
@kenXengineering
Copy link
Contributor

As a workaround for now, you can set restriction_type to none.

@bflad
Copy link
Member

bflad commented Jun 24, 2020

This should have been fixed with #12168, which was released a few months ago in version 2.52.0 of the Terraform AWS Provider. If you are still having trouble with this, please open a new issue and we will take a fresh look, thanks.

@bflad bflad closed this as completed Jun 24, 2020
@ghost
Copy link

ghost commented Jul 25, 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 Jul 25, 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. crash Results from or addresses a Terraform crash or kernel panic. service/cloudfront Issues and PRs that pertain to the cloudfront service. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

No branches or pull requests

4 participants