Slide 1

Slide 1 text

Managing PostgreSQL with Terraform Carlos León Skelleftech 25-Nov-2022 Skellefteå, Sweden

Slide 2

Slide 2 text

Cloud Native Specialist @ CoreX Social Media: - mastodon: @[email protected] - Twitter: @mongrelion - LinkedIn: https://www.linkedin.com/in/mongrelion/ - [email protected]

Slide 3

Slide 3 text

Introduction to IaC

Slide 4

Slide 4 text

What is not IaC?

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

What is IaC?

Slide 7

Slide 7 text

Foundation - Servers - Public IPs - Load Balancers - Firewalls - API Gateways - DNS zones + records - Service Principals / Non-personal Accounts - Mail campaigns - PagerDuty users, groups, alert rules, etc - A big et cétera

Slide 8

Slide 8 text

server-a public IP firewall load balancer server-b dc-sft-a

Slide 9

Slide 9 text

server-a server-b dc-sft-a Input: - CPU - RAM - DISK Output: - Hostname - LAN IP

Slide 10

Slide 10 text

server-a load balancer server-b dc-sft-a Input: - server-a LAN IP - server-b LAN IP Output: - LAN IP

Slide 11

Slide 11 text

server-a firewall load balancer server-b dc-sft-a Input: - load balancer LAN IP - Inboud rules - Outboud rules Output: - LAN IP

Slide 12

Slide 12 text

server-a public IP firewall load balancer server-b dc-sft-a Input: - firewall LAN IP Output: - public IP

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Web application with PostgreSQL as the main database

Slide 16

Slide 16 text

frontend backend

Slide 17

Slide 17 text

admin app reader

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Considerations - Security (traceability, blast radius limitation) - Reusability/DRY - Principle of least privilege is widely adopted in the industry - Initial work is “more” than just hacking into the server

Slide 25

Slide 25 text

Can we do it with code?

Slide 26

Slide 26 text

Jajamänsan!

Slide 27

Slide 27 text

The database

Slide 28

Slide 28 text

The roles

Slide 29

Slide 29 text

The grants

Slide 30

Slide 30 text

terraform plan

Slide 31

Slide 31 text

Q&A

Slide 32

Slide 32 text

Tackar!