GispoCoding / tarmo

Tarmo - Tampere Mobilemap
https://ulkoilutampereenseutu.fi/
MIT License
11 stars 3 forks source link

Harden the terraform configuration #26

Closed Joonalai closed 2 years ago

Joonalai commented 2 years ago

Some examples:

Useful links:

Rikuoja commented 2 years ago

While at it, fix the conflict between lb security group and security group rule resources. Causes recreating/destroying resources between runs.

From https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule

Terraform currently provides both a standalone Security Group Rule resource (a single ingress or egress rule), and a Security Group resource with ingress and egress rules defined in-line. At this time you cannot use a Security Group with in-line rules in conjunction with any Security Group Rule resources. Doing so will cause a conflict of rule settings and will overwrite rules.

Rikuoja commented 2 years ago

Lambda needs VPC connections:

https://www.maxivanov.io/deploy-aws-lambda-to-vpc-with-terraform/

Rikuoja commented 2 years ago

VPC and security group rules implemented. DB can only be accessed from the ec2 instance in the same VPC.