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

Create DNS zone record so we can get freenom using the correct nameservers #23

Merged
merged 5 commits into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The [terraform code](https://github.com/MarkIannucci/terraform-aws-atlantis/tree
# Things I'd do differently if I had more time

* I'd write the script that commits the files to the data branch to only commit data to the data branch if it were running from the main branch. If it were running from any other branch, it'd commit the files to the data-branchname branch. The current config could easily split brain. Additionally the approach to branch switching that I'm using currently makes continued progress on github actions quite clunky. See [commit fbe6548c](https://github.com/marknooch/foodtrucks/commit/fbe6548c587d931dd31a8b67ce2c1e04dbbb2215) for an example of the clunk.
* Figure out how to configure Atlantis + github to require an apply if necessary for a PR to be completed. #24
* Implement mapbox pubic token creation/rotation with a github action -- current implementation embeds the public access token in source and is [secret sprawly](https://www.hashicorp.com/resources/what-is-secret-sprawl-why-is-it-harmful). ~~The token has an access policy allowing it to only be accessed from domains I control.~~ once we implement #18.
* Some of the content could be easily hosted on github which would have reduced the github actions complexity and AWS cost.

Expand Down
28 changes: 28 additions & 0 deletions terraform/route53.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
resource "aws_route53_zone" "main" {
name = var.domain-name
}

# comment out so we can get the zone and configure name records in freenom before getting the rest of this stuff setup
# resource "aws_route53_record" "root-a" {
# zone_id = aws_route53_zone.main.zone_id
# name = var.domain-name
# type = "A"

# alias {
# name = aws_cloudfront_distribution.root_s3_distribution.domainvar.domain-name
# zone_id = aws_cloudfront_distribution.root_s3_distribution.hosted_zone_id
# evaluate_target_health = false
# }
# }

# resource "aws_route53_record" "www-a" {
# zone_id = aws_route53_zone.main.zone_id
# name = "www.${var.domain-name}"
# type = "A"

# alias {
# name = aws_cloudfront_distribution.www_s3_distribution.domainvar.domain-name
# zone_id = aws_cloudfront_distribution.www_s3_distribution.hosted_zone_id
# evaluate_target_health = false
# }
# }
3 changes: 2 additions & 1 deletion terraform/s3.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# create bucket for static website
resource "aws_s3_bucket" "s3-home" {
acl = "public-read"
bucket_prefix = "foodtrucks"
acl = "public-read"

website {
index_document = "index.html"
Expand Down
2 changes: 1 addition & 1 deletion terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ variable "region" {

variable "domain-name" {
description = "domain name which redirects to CloudFront"
default = "findafoodtruck.ga"
default = "findafoodtrucknow.ga"
}

variable "tags" {
Expand Down