diff --git a/terraform/.terraform.lock.hcl b/terraform/.terraform.lock.hcl index babc7c8..e96e0f1 100644 --- a/terraform/.terraform.lock.hcl +++ b/terraform/.terraform.lock.hcl @@ -1,6 +1,28 @@ # This file is maintained automatically by "terraform init". # Manual edits may be lost in future updates. +provider "registry.terraform.io/hashicorp/aws" { + version = "6.27.0" + hashes = [ + "h1:emgTfB1LXSFYh9uAwgsRMoMIN5Wz7jNNKq3rqC0EHWk=", + "zh:177a24b806c72e8484b5cabc93b2b38e3d770ae6f745a998b54d6619fd0e8129", + "zh:4ac4a85c14fb868a3306b542e6a56c10bd6c6d5a67bc0c9b8f6a9060cf5f3be7", + "zh:552652185bc85c8ba1da1d65dea47c454728a5c6839c458b6dcd3ce71c19ccfc", + "zh:60284b8172d09aee91eae0856f09855eaf040ce3a58d6933602ae17c53f8ed04", + "zh:6be38d156756ca61fb8e7c752cc5d769cd709686700ac4b230f40a6e95b5dbc9", + "zh:7a409138fae4ef42e3a637e37cb9efedf96459e28a3c764fc4e855e8db9a7485", + "zh:8070cf5224ed1ed3a3e9a59f7c30ff88bf071c7567165275d477c1738a56c064", + "zh:894439ef340a9a79f69cd759e27ad11c7826adeca27be1b1ca82b3c9702fa300", + "zh:89d035eebf08a97c89374ff06040955ddc09f275ecca609d0c9d58d149bef5cf", + "zh:985b1145d724fc1f38369099e4a5087141885740fd6c0b1dbc492171e73c2e49", + "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", + "zh:a80b47ae8d1475201c86bd94a5dcb9dd4da5e8b73102a90820b68b66b76d50fd", + "zh:d3395be1556210f82199b9166a6b2e677cee9c4b67e96e63f6c3a98325ad7ab0", + "zh:db0b869d09657f6f1e4110b56093c5fcdf9dbdd97c020db1e577b239c0adcbce", + "zh:ffc72e680370ae7c21f9bd3082c6317730df805c6797427839a6b6b7e9a26a01", + ] +} + provider "registry.terraform.io/hetznercloud/hcloud" { version = "1.57.0" constraints = "~> 1.45" diff --git a/terraform/ingress.tf b/terraform/ingress.tf new file mode 100644 index 0000000..04f590d --- /dev/null +++ b/terraform/ingress.tf @@ -0,0 +1,21 @@ +// Create load balancer for ingress. +resource "hcloud_load_balancer" "lb" { + name = "lb" + load_balancer_type = "lb11" + network_zone = "eu-central" +} + +# The Route53 DNS zone. +data "aws_route53_zone" "main" { + name = local.domain +} + +# Push all domain traffic through the reverse proxy. +resource "aws_route53_record" "domain" { + for_each = toset(["*.${local.domain}", "${local.domain}"]) + zone_id = data.aws_route53_zone.main.zone_id + name = each.value + type = "A" + ttl = "60" + records = [hcloud_load_balancer.lb.ipv4] +} diff --git a/terraform/main.tf b/terraform/network.tf similarity index 100% rename from terraform/main.tf rename to terraform/network.tf diff --git a/terraform/providers.tf b/terraform/providers.tf index 462c362..3a85e77 100644 --- a/terraform/providers.tf +++ b/terraform/providers.tf @@ -16,3 +16,10 @@ terraform { provider "hcloud" { token = var.hcloud_token } + +provider "aws" { + region = var.aws_region + access_key = var.aws_access_key + secret_key = var.aws_secret_key +} + diff --git a/terraform/variables.tf b/terraform/variables.tf index 54ad85d..9082cba 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -8,6 +8,8 @@ locals { node-a = "10.0.2.9" node-b = "10.0.2.10" } + + domain = "maximhutz.com" } variable "public_key_file" { @@ -19,3 +21,21 @@ variable "hcloud_token" { type = string sensitive = true } + +variable "aws_region" { + description = "The region of the AWS account." + type = string + sensitive = true +} + +variable "aws_access_key" { + description = "The access key of the account." + type = string + sensitive = true +} + +variable "aws_secret_key" { + description = "The secret key of the account." + type = string + sensitive = true +} diff --git a/vault.yml b/vault.yml index aebb082..40fd61a 100644 --- a/vault.yml +++ b/vault.yml @@ -1,30 +1,36 @@ $ANSIBLE_VAULT;1.1;AES256 -39353161316464393931613836373735326631623763363337313366303631326661356239346261 -3939383335343235643439393434353266376662336136640a616231346663633738336265393437 -61386631343036353765643139373764353437323562376263316562346430613837663833383638 -3866353634633564310a343435393662626239666564363631666165326364313730653031393466 -63316539346466663535306232633835306664353262376366623630653730386565333262326430 -65656435386530623463643436626236393065376639636161316161313236376565353761653835 -65313039313339323933343765303561643631346236396638306131613936666165353661613731 -31333162613364333230396638363663613435613637313536623330336463613363623034613565 -38326332343537323364373930623435313231666264646562383930633731306130323938393838 -35646261646635303030373265396139336363656463633230646332643832336239323137633337 -62343438616266623630336235663563666432383732393963396436613934653931633036346332 -66376433376265363539313435383965316564653232333737333137383065363362346562346463 -65343033353163316430656132663261626562323762303165633666613233353132376531303532 -66376131396633366435336165326432356535663232643631316464613065316139623363356537 -66326634656330303537376633633463616663633761643561306665326364333464333163386635 -37376362643065656265386232373066313562396139636131626330303364353636613139383565 -63393733303638393335303765343366353063633433666363323631303334396537323430366361 -65313131383339383265323436356630623265313436653565346133383335303862613234663539 -65366434623639346261373361393065386466623061613165326436313935376137363236333663 -36653933623836316163663531373139303334333162393637613633303261653934623830313337 -63363931393639373533393236646361313938643062356436626266373339316437323930383464 -61306132303463623162646264613439386137396464613930353439646135313036356138323039 -37366430386661333862666364313563663239383435613161613436313831633863356465623437 -62343639336638346663363036313965623833616632653065313031393137656562663563613637 -62396130396238333232323632656334333030373265613230306332643166353135656335346535 -38316265383866306333356263643233333861663036316164313932306134396133356332336461 -32323833323430653830396430393731343961393638656534663963333632646364303063356432 -33623436646539373864386535383832333461313936613363346433666636623561373837383537 -6237 +35323436626135616534616432353038616532613138393165366534663361636633303336643766 +6538656163363065363832333961653736373231366230340a363539376639323635303131343966 +38626563666630663934333633303636323964666339353035396566326634336134666436383061 +3838623462363565640a383832306334646530326133653235323730386563343462316332333236 +65646265356132343761323661636235363838643838343936353862646336376461633433666364 +36613763346439636263303166323662633237353533363064613437636561616538343832656531 +31323064663534363234303633386562313565366366366533383761663466326333393135343534 +31646263333736353132356136343765396362373864616261363666636262313631303663653765 +64356133656536333366663237366562343266383462323630346434363065303466373035386131 +63356434396433353731656233346465656536303437656232353831373062386161313165326164 +61393031613733396131643762363465303833326633326364343631383733383966343965306530 +65316638633132633562316637373166623631636237346435613733336333616138323534633266 +33623362653166646639373137396265353064326435646138336635383232663437336238343366 +66613735306235353563383762383763653964313766616539336362616332663138353233326261 +36313631663832633163633966613864323331356362376437393563323061303864646665623332 +65363236323339346232303763326636333935306363323164626635663833356661386532303430 +31346133313639356361316563343761623466633030633030333138353538656633643630653862 +34633638666562656434346636613136323461353565323133613461646638366135353638393834 +36373030643030303365353531313665643666383433333562626532323363366432336333623733 +62306462616538313139646437333363616364343766636562366235613635373335613164336361 +33313130353361373164643833636231383233323034313861343134363964653031396530643537 +36626561303839653234313466356330633666386166623335623864653935316566366539626238 +62663438643730653463343634626361633766343366626266386538326136323932626636313864 +66393465646366633036396538336662643230646631623436386462383434643665383233393930 +38306265393832386262616261643863306438656662666333306662366464393736623939656565 +33353637353861636562323639306562343235316566353130663563623538656131363132356231 +61636239346138353833633065633030653138306262633830303739356662353063363032656439 +34623336336233626362316638663335613639363533393833623533306334636532623264323966 +64393234656463643438303630306565353534663066363065383533336130323434393131326166 +61636538356265343937626435653763366333326364376461616138313637316535636238376263 +63316430323863316366653338653261373438626563643433346133363031313464323964326230 +30626461333437316332616462373334643736623930666432343966623436623834613038626137 +35613730303166303739316132306164383965636532663563613166373337363030636630346164 +63396166353534373338626261366437653662353166366263653562316562313433616232323636 +373163323937626435303963323632343631