File tree Expand file tree Collapse file tree 5 files changed +19
-22
lines changed
modules/terraform-aws-nixos-webserver-wrapper Expand file tree Collapse file tree 5 files changed +19
-22
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ resource "aws_route53_record" "www" {
1111 name = " www.${ var . base_domain } ."
1212 type = " A"
1313 ttl = " 300"
14- # records = [ aws_instance.email_server.public_ip ]
1514 records = [ aws_eip . web_server . public_ip ]
1615}
1716
@@ -30,7 +29,6 @@ resource "aws_route53_record" "a" {
3029 name = " ${ var . base_domain } ."
3130 type = " A"
3231 ttl = " 300"
33- # records = [ aws_instance.email_server.public_ip ]
3432 records = [ aws_eip . web_server . public_ip ]
3533}
3634
Original file line number Diff line number Diff line change 77 ec2.hvm = true ;
88
99 networking = {
10- hostName = " mikemcgirr" ;
11- # TODO set with Terraform Template var
10+ hostName = " ${hostname}" ;
1211
1312 enableIPv6 = true ;
1413
3837 enableACME = true ;
3938
4039 locations." /" = {
41- # TODO set from an input variable
42- root = " /var/www/mikemcgirr-com/_site" ;
40+ root = " /var/www/${content_location}/_site" ;
4341 } ;
44-
45-
4642 };
4743
4844 # TODO combine this with the above so that this doesn't repeat itself
5349 enableACME = true ;
5450
5551 locations." /" = {
56- # TODO set from an input variable
57- root = " /var/www/mikemcgirr-com/_site" ;
52+ root = " /var/www/${content_location}/_site" ;
5853 } ;
59-
6054 };
6155
6256 };
Original file line number Diff line number Diff line change 44
55ssh -i ./id_rsa root@${ip} " nix-channel --update && nixos-rebuild switch"
66
7- ssh -i ./id_rsa root@${ip} " mkdir -p /var/www/mikemcgirr-com"
8- # TODO set this with an input variable
7+ ssh -i ./id_rsa root@${ip} " mkdir -p /var/www/${content_location} "
98
10- # then scp the website file at this point
11- scp -i ./id_rsa -P 22 -r ../../mikemcgirr-com/_site root@ ${ip} :/var/www/mikemcgirr-com/.
12- # TODO set this with an input variable
9+ # Then scp the website file at this point.
10+ # This assumes the static blog content you'd initially like to move over is located two directories up
11+ scp -i ./id_rsa -P 22 -r ../../ ${content_location} /_site root@ ${ip} :/var/www/ ${content_location} /.
1312
1413# then scp the configuration.nix file at this point
1514scp -i ./id_rsa -P 22 configuration.nix root@${ip} :/etc/nixos/configuration.nix
1615
17- ssh -i ./id_rsa root@${ip} " nix-channel --update && nixos-rebuild switch"
16+ ssh -i ./id_rsa root@${ip} " nix-channel --update && nixos-rebuild switch"
Original file line number Diff line number Diff line change @@ -8,11 +8,21 @@ variable "base_domain" {
88 type = string
99}
1010
11+ variable "hostname" {
12+ description = " The hostname to set on the AWS instance"
13+ type = string
14+ }
15+
1116variable "email" {
1217 description = " The email to use for the cert emails."
1318 type = string
1419}
1520
21+ variable "content_location" {
22+ description = " The location on the AWS instance where the web content will be located."
23+ type = string
24+ }
25+
1626variable "region" {
1727 description = " The region to create AWS resources in for the web server"
1828 type = string
@@ -93,11 +103,8 @@ variable "vpc_extra_tags" {
93103 type = map
94104}
95105
96- # TODO review
97- # if the description here is confusing, see the semantics that `merge()` uses:
98- # https://www.terraform.io/docs/configuration/interpolation.html#merge-map1-map2-
99106variable "extra_tags" {
100- description = " Extra tags that will be added to ALL RESOURCES, use the resource-specific variables if you need that level of control. Note that keys may be overwritten in cases where there are duplicates ."
107+ description = " Extra tags that will be added to all resources ."
101108 default = {} # TODO remove default
102109 type = map
103110}
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ module "web-server-sg" {
1111module "web-server-ssh-rule" {
1212 source = " fpco/foundation/aws//modules/ssh-sg"
1313 version = " 0.9.4"
14- # cidr_blocks = var.allowed_remote_cidrs # TODO maybe add a bastion host eventually
1514 cidr_blocks = [" 0.0.0.0/0" ]
1615 # ipv6_cidr_blocks = ["::/0" ] # TODO add ipv6 to the upstream module
1716 security_group_id = module. web-server-sg . id
You can’t perform that action at this time.
0 commit comments