@@ -91,6 +91,10 @@ tfplan
9191# # Step 5 - Main terraform file main.tf
9292
9393
94+
95+ First of all install Terraform as described here [terraform installation](https://developer.hashicorp.com/terraform/install#linux).
96+
97+
9498Create file `main.tf` in `deploy` folder :
9599
96100` ` ` hcl title="deploy/main.tf"
@@ -122,7 +126,7 @@ data "aws_vpc" "default" {
122126
123127
124128resource "aws_eip" "eip" {
125- vpc = true
129+ domain = "vpc"
126130}
127131resource "aws_eip_association" "eip_assoc" {
128132 instance_id = aws_instance.app_instance.id
@@ -189,7 +193,7 @@ resource "aws_instance" "app_instance" {
189193 key_name = aws_key_pair.app_deployer.key_name
190194
191195 root_block_device {
192- volume_size = 40 // Size in GB for root partition
196+ volume_size = 20 // Size in GB for root partition
193197 volume_type = "gp2"
194198 }
195199
@@ -238,8 +242,6 @@ resource "null_resource" "sync_files_and_run" {
238242 --exclude '.vscode' \
239243 --exclude '.env' \
240244 --exclude 'db' \
241- --exclude 'up-human/debug' \
242- --exclude 'up-human/storage' \
243245 ../ ubuntu@${aws_eip_association.eip_assoc.public_ip}:/home/ubuntu/app/
244246 EOF
245247 }
@@ -375,6 +377,7 @@ terraform {
375377 region = "eu-central-1"
376378 profile = "myaws"
377379 dynamodb_table = "<your_app_name>-terraform-lock-table"
380+ use_lockfile = true
378381 }
379382}
380383` ` `
@@ -395,6 +398,9 @@ Now run test deployment:
395398terraform apply -auto-approve
396399` ` `
397400
401+ Now you can delete local `terraform.tfstate` file and `terraform.tfstate.backup` file as they are in the cloud now.
402+
403+
398404# # Step 7 - CI/CD - Github Actions
399405
400406Create file `.github/workflows/deploy.yml` :
0 commit comments