fakecloud icon indicating copy to clipboard operation
fakecloud copied to clipboard

Cloudfront Distribution endpoint not giving correct defaults

Open slimeandsoakem opened this issue 4 weeks ago • 2 comments

When running terraform without restrictions and other defaults.

What should come back from AWS is

  <Id>EDFDVBD632BHDS5</Id>
  <Status>Deployed</Status>
  <LastModifiedTime>2026-11-07T12:00:00.000Z</LastModifiedTime>
  <DomainName>d111111abcdef8.cloudfront.net</DomainName>
  <DistributionConfig>
    <!-- ... Origins, DefaultCacheBehavior ... -->

    <!-- MUST BE PRESENT: If missing, AWS Provider crashes at line 1150 -->
    <OriginGroups>
      <Quantity>0</Quantity>
    </OriginGroups>

    <!-- MUST BE PRESENT: If missing, crashes in flattenRestrictions -->
    <Restrictions>
      <GeoRestriction>
        <RestrictionType>none</RestrictionType>
        <Quantity>0</Quantity>
      </GeoRestriction>
    </Restrictions>

    <!-- MUST BE PRESENT: -->
    <CustomErrorResponses>
      <Quantity>0</Quantity>
    </CustomErrorResponses>

    <!-- MUST BE PRESENT: -->
    <Aliases>
      <Quantity>0</Quantity>
    </Aliases>
  </DistributionConfig>
</Distribution>```

slimeandsoakem avatar Nov 08 '26 20:11 slimeandsoakem

Have a PR that fixes this - admittedly I have swerved updating the models structs optionality, and instead plumbed in defaults on a distribution on the get, create and update calls. Just firing this one in in case anyone else discovers the same issue.

https://github.com/faiscadev/fakecloud/pull/2779

slimeandsoakem avatar Nov 08 '26 20:11 slimeandsoakem

Fixed by #2779, which fills in AWS's defaults for omitted distribution config, and is merged to main. Real Terraform aws_cloudfront_distribution now applies, plans with no changes, and destroys against it.

vieiralucas avatar Nov 09 '26 03:11 vieiralucas