Last active
September 9, 2019 20:16
-
-
Save valtermartins1301/c3e86640aef7692a89c178c939eaa835 to your computer and use it in GitHub Desktop.
Revisions
-
valtermartins1301 revised this gist
Sep 9, 2019 . 1 changed file with 0 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +0,0 @@ -
valtermartins1301 revised this gist
Sep 9, 2019 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ # Terraform to create Netlify environment with Github + Route53 (AWS) ## Providers - (Netlify)[https://github.com/terraform-providers/terraform-provider-netlify] - (AWS)[https://github.com/terraform-providers/terraform-provider-aws] - (Github)[https://github.com/terraform-providers/terraform-provider-github] -
valtermartins1301 revised this gist
Sep 9, 2019 . No changes.There are no files selected for viewing
-
valtermartins1301 renamed this gist
Sep 9, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
valtermartins1301 revised this gist
Sep 9, 2019 . No changes.There are no files selected for viewing
-
valtermartins1301 renamed this gist
Sep 9, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
valtermartins1301 created this gist
Sep 9, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ .terraform *.tfplan *.tfstate *.tfstate.backup This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ terraform { required_version = "~> 0.11.14" backend "s3" {} } # Setting AWS region provider "aws" { region = "${var.region}" version = "~> 2.20" } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ data "aws_route53_zone" "route53_zone" { name = "${var.route53_record_alias_zone}" private_zone = false } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ provider "github" { token = "${var.github_token}" organization = "your-organization" } resource "github_repository_deploy_key" "key" { title = "Netlify" repository = "your-repository-name" key = "${netlify_deploy_key.key.public_key}" read_only = false } resource "github_repository_webhook" "main" { repository = "your-repository-name" events = ["delete", "push", "pull_request"] configuration { content_type = "json" url = "https://api.netlify.com/hooks/github" } depends_on = ["netlify_site.main"] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ # Configure the Netlify Provider provider "netlify" { token = "${var.netlify_token}" } # Create a new deploy key for this specific website resource "netlify_deploy_key" "key" {} # Define your site resource "netlify_site" "main" { name = "${var.name}-${var.environment}" custom_domain = "${aws_route53_record.www.name}" repo { repo_branch = "master" command = "${var.build_command}" deploy_key_id = "${netlify_deploy_key.key.id}" dir = "build" provider = "github" repo_path = "your-repo/path" } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ resource "aws_route53_record" "www" { zone_id = "${data.aws_route53_zone.route53_zone.zone_id}" name = "${var.name}.${var.environment}.your-domain.com" type = "CNAME" ttl = "300" records = ["${var.name}-${var.environment}.netlify.com."] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ variable "profile" { default = "default" } variable "region" {} variable "name" {} variable "build_command" { default = "yarn build" } variable "github_token" {} variable "netlify_token" {} variable "route53_record_alias_zone" {} variable "environment" {}