How to create Cloudfront from scratch via terraform?
Install terraform
Download link : https://www.terraform.io/downloads.html
Configure aws CLI
Create cloudfront.tf file
Create variable.tf file
both above mention files are present with repo.
It includes custom_header which is useful in allow cross origin. It helps in solving CORS issue
Example:
custom_header = { name = "Access-Control-Allow-Origin" value = "*" }