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 doesn't support ALB site as an Origin #412

Open
hashibot opened this issue Jun 13, 2017 · 4 comments
Open

AWS Cloudfront doesn't support ALB site as an Origin #412

hashibot opened this issue Jun 13, 2017 · 4 comments
Labels
bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. service/cloudfront Issues and PRs that pertain to the cloudfront service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@hashibot
Copy link

This issue was originally opened by @aloysiuschang as hashicorp/terraform#10572. It was migrated here as part of the provider split. The original body of the issue is below.


Hello everyone

On document said terraform support S3 or Website be a Origin, but I try many time get same error is: The parameter Origin DomainName does not refer to a valid S3 bucket

Here's my cloudfront.tf

resource "aws_cloudfront_distribution" "my_web_site" {
  origin {
    domain_name = "#{aws_alb.website.dns_name}"
    origin_id = "website_access_id"

  }
  enabled = true

  logging_config {
    include_cookies = false
    bucket          = "mywebsiteaccesslogcf.s3.amazonaws.com"
  }

  default_cache_behavior {
    allowed_methods = [HEAD, DELETE, POST, GET, OPTIONS, PUT, PATCH]
    cached_methods = ["HEAD", "GET"]
    compress = true
    target_origin_id = "website_access_id"

    forwarded_values {
      query_string = false
      cookies {
        forward = "none"
      }
    }

    viewer_protocol_policy = "allow-all"
    min_ttl     = 0
    default_ttl = 3600
    max_ttl     = 86400
  }

  restrictions {
    geo_restriction {
      restriction_type = "none"
    }
  }

  tags {
    Environment = "${var.environment_name}"
  }

  viewer_certificate {
    iam_certificate_id = "${var.elb_cert}"
    ssl_support_method = "sni-only"
  }
}

and I got this error below:

`Error applying plan:

1 error(s) occurred:

  • aws_cloudfront_distribution.my_web_site: InvalidArgument: The parameter Origin DomainName does not refer to a valid S3 bucket.
    status code: 400, request id: 242113c0-bc4d-11e6-afa0-5da45ee7023c
    `
@hashibot hashibot added the bug Addresses a defect in current functionality. label Jun 13, 2017
@radeksimko radeksimko added the service/cloudfront Issues and PRs that pertain to the cloudfront service. label Jan 25, 2018
@roarmstrong
Copy link

I encountered this error as well. My solution was adding a custom_origin_config block to origin. If you don't specify a custom_origin_config Terraform will create an empty s3_origin_config. See https://github.com/terraform-providers/terraform-provider-aws/blob/a45d3a5db79961a537316bec331104def16a617b/aws/cloudfront_distribution_configuration_structure.go#L662

@jarrettj
Copy link

Is it possible? Or a not going to add feature? Thanks.

@jarrettj
Copy link

Nevermind! Thanks @roarmstrong :)

@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Apr 9, 2023
nuno407 pushed a commit to nuno407/terraform-provider-aws that referenced this issue Apr 17, 2024
Co-authored-by: Afonso Sousa <soa5brg@bosch.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. service/cloudfront Issues and PRs that pertain to the cloudfront service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

5 participants