Skip to content
Snippets Groups Projects
Commit 81b23d04 authored by Kenneth's avatar Kenneth
Browse files

Update terraform to accept ssh communication

parent c9e7c247
No related branches found
No related tags found
No related merge requests found
......@@ -86,6 +86,18 @@ Dans le terminal, se placer au niveau de app.py
flask app.py
```
## DUMP d'une base locale
```
pg_dump -h localhost -U postgres -d mydb -v -f ~/Cours_Architecture_logiciel/web_app/mydb.dump
```
Aller sur le fichier .dump et faite
il est nécessaire de retrouver le endpoint sur RDs
```
pg_restore -h kennethhugo-dev-rds-instance.cx4q20s8stp5.eu-west-3.rds.amazonaws.com -U postgres -f mydb.dump
```
## Sitographie
https://medium.com/@samanthasalustri/why-pipenv-is-the-preferred-virtual-environment-tool-for-python-316bc54a5f13
......
No preview for this file type
......@@ -43,6 +43,67 @@ data "aws_vpc" "this" {
}
}
data "aws_subnet" "public" {
filter {
name = "tag:Name"
values = ["PUBLIC_SUBNET"]
}
}
data "aws_subnet" "private-a" {
filter {
name = "tag:Name"
values = ["PRIVATE_SUBNET_A"]
}
}
data "aws_subnet" "private-b" {
filter {
name = "tag:Name"
values = ["PRIVATE_SUBNET_B"]
}
}
data "aws_vpc" "selected" {
filter {
name = "tag:Name"
values = ["VPC"]
}
}
resource "aws_key_pair" "ec2" {
key_name = lower("${var.identifiant}_key")
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCdgUoVRIPCQHlBoaz6UfrvQ4gw2sxeV3PIgCmCSXUW+I9beSfrBs4ELbiuUsV33Y8rKRNQBxa60+J0bEwNtIXRARN7bfdVmukoIJ/LBPcj1XzjmcVE4RJCxSRQbiMYnbUG6Ps5m1sMXsGf0WoPuXIsYoRKHa4QtcqSqqm/G/BW4a0Kvwdfww2dYCKhNoniSPAnDGPowQpGzTc3nvO/ED7polY9T1b6kqaw5WSCWic/qUfgJ2Lxn+bus72vgelhqZhFSqJgTL2e3xPmqtmrUO/4U2kjF3YH120syEfvQFIg/PozQqfkupbDPB1Cx7/1ThZLpJT5Dv1I/kCuZQuNNZj7"
}
resource "aws_security_group" "ec2" {
name = "${var.identifiant}_SG_EC2"
description = "ec2 Security Group"
vpc_id = data.aws_vpc.selected.id
tags = { Name = "${var.identifiant}_SG_EC2" }
lifecycle {
create_before_destroy = true
}
}
resource "aws_security_group_rule" "allow_ec2_to_bastion" {
type = "ingress"
from_port = 22
to_port = 22
protocol = "tcp"
source_security_group_id = data.aws_security_group.bastion.id
security_group_id = aws_security_group.ec2.id
}
resource "aws_security_group_rule" "ssh_api_from_bastion" {
type = "ingress"
from_port = 22
to_port = 22
protocol = "tcp"
source_security_group_id = data.aws_security_group.bastion.id
security_group_id = aws_security_group.sg_api.id
description = "SSH from Bastion to API"
}
####################################
# Subnets (A et B) - 2 AZ différentes
####################################
......@@ -82,16 +143,16 @@ resource "aws_security_group" "sg_client" {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = [var.my_ip]
# var.my_ip = "0.0.0.0/0" par défaut, ou votre IP
security_groups = [data.aws_security_group.bastion.id]
//cidr_blocks = []
}
# Autorise tout en sortie
# Autorise l'API en sortie
egress {
from_port = 0
to_port = 0
protocol = -1
cidr_blocks = ["0.0.0.0/0"]
from_port = 80
to_port = 80
protocol = "tcp"
}
tags = {
......@@ -109,14 +170,17 @@ resource "aws_security_group" "sg_api" {
from_port = 5000
to_port = 5000
protocol = "tcp"
security_groups = [aws_security_group.sg_client.id]
security_groups = [aws_security_group.sg_client.id,data.aws_security_group.bastion.id]
}
# ON autorise la connexion vers le RDS
egress {
from_port = 0
to_port = 0
protocol = -1
description = "Allow traffic to RDS (5432)"
from_port = 5432
to_port = 5432
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
/*data.aws.subnet.private_subnet_a.cidr_blocks*/
}
tags = {
......@@ -134,7 +198,7 @@ resource "aws_security_group" "sg_rds" {
from_port = 5432
to_port = 5432
protocol = "tcp"
security_groups = [aws_security_group.sg_api.id]
security_groups = [aws_security_group.sg_api.id, data.aws_security_group.bastion.id]
}
egress {
......@@ -149,6 +213,13 @@ resource "aws_security_group" "sg_rds" {
}
}
data "aws_security_group" "bastion" {
filter {
name = "tag:Name"
values = ["SG_BASTION_EC2"]
}
}
####################################
# Instances EC2 : Client et API
####################################
......@@ -172,6 +243,7 @@ data "aws_ami" "amazon_linux_2" {
resource "aws_instance" "client" {
ami = data.aws_ami.amazon_linux_2.id
instance_type = "t2.micro"
key_name = aws_key_pair.ec2.id
# On la met, par exemple, dans le subnet A
subnet_id = aws_subnet.private_subnet_a.id
......@@ -186,6 +258,7 @@ resource "aws_instance" "client" {
resource "aws_instance" "api" {
ami = data.aws_ami.amazon_linux_2.id
instance_type = "t2.micro"
key_name = aws_key_pair.ec2.id
# On peut la mettre aussi dans le subnet A (ou B, au choix)
subnet_id = aws_subnet.private_subnet_a.id
......@@ -212,15 +285,22 @@ resource "aws_db_subnet_group" "this" {
Name = upper("${var.identifiant}_${terraform.workspace}_RDS_SUBNET_GROUP")
}
}
variable "db_name" {
type = string
description = "Nom de la base de données RDS"
default = "mydb_hk"
}
/*
resource "aws_db_instance" "mydb" {
allocated_storage = 5
engine = "postgres"
engine_version = "14.15"
instance_class = "db.t2.micro"
instance_class = "db.t3.micro"
username = "postgres"
db_name = "mydb_HK"
password = "mysecretpassword"
multi_az = false
identifier = lower("${var.identifiant}-${terraform.workspace}-RDS-INSTANCE")
skip_final_snapshot = true
db_subnet_group_name = aws_db_subnet_group.this.name
......@@ -231,4 +311,3 @@ resource "aws_db_instance" "mydb" {
Name = upper("${var.identifiant}_${terraform.workspace}_RDS_INSTANCE")
}
}
*/
\ No newline at end of file
{
"version": 4,
"terraform_version": "1.10.5",
"serial": 70,
"serial": 113,
"lineage": "eded4345-a67f-9a4a-9ad8-c68c205f47c2",
"outputs": {},
"resources": [
......@@ -125,6 +125,234 @@
}
]
},
{
"mode": "data",
"type": "aws_security_group",
"name": "bastion",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-0a7ccf14d1b6468fa",
"description": "ec2 Security Group",
"filter": [
{
"name": "tag:Name",
"values": [
"SG_BASTION_EC2"
]
}
],
"id": "sg-0a7ccf14d1b6468fa",
"name": "SG_BASTION_EC2",
"tags": {
"Name": "SG_BASTION_EC2"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_subnet",
"name": "private-a",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-002aaa6589cef6028",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3a",
"availability_zone_id": "euw3-az1",
"available_ip_address_count": 240,
"cidr_block": "10.0.1.0/24",
"customer_owned_ipv4_pool": "",
"default_for_az": false,
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"filter": [
{
"name": "tag:Name",
"values": [
"PRIVATE_SUBNET_A"
]
}
],
"id": "subnet-002aaa6589cef6028",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": false,
"outpost_arn": "",
"owner_id": "920373009484",
"private_dns_hostname_type_on_launch": "ip-name",
"state": "available",
"tags": {
"Name": "PRIVATE_SUBNET_A",
"Private": "yes"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_subnet",
"name": "private-b",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-0fc06a60f4305264c",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3b",
"availability_zone_id": "euw3-az2",
"available_ip_address_count": 245,
"cidr_block": "10.0.2.0/24",
"customer_owned_ipv4_pool": "",
"default_for_az": false,
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"filter": [
{
"name": "tag:Name",
"values": [
"PRIVATE_SUBNET_B"
]
}
],
"id": "subnet-0fc06a60f4305264c",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": false,
"outpost_arn": "",
"owner_id": "920373009484",
"private_dns_hostname_type_on_launch": "ip-name",
"state": "available",
"tags": {
"Name": "PRIVATE_SUBNET_B",
"Private": "yes"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_subnet",
"name": "public",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-0d9d21b769bca92d7",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3a",
"availability_zone_id": "euw3-az1",
"available_ip_address_count": 248,
"cidr_block": "10.0.0.0/24",
"customer_owned_ipv4_pool": "",
"default_for_az": false,
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"filter": [
{
"name": "tag:Name",
"values": [
"PUBLIC_SUBNET"
]
}
],
"id": "subnet-0d9d21b769bca92d7",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": false,
"outpost_arn": "",
"owner_id": "920373009484",
"private_dns_hostname_type_on_launch": "ip-name",
"state": "available",
"tags": {
"Name": "PUBLIC_SUBNET",
"Private": "no"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_vpc",
"name": "selected",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:vpc/vpc-08da87242304c9723",
"cidr_block": "10.0.0.0/16",
"cidr_block_associations": [
{
"association_id": "vpc-cidr-assoc-0fd519069ef9f4ba9",
"cidr_block": "10.0.0.0/16",
"state": "associated"
}
],
"default": false,
"dhcp_options_id": "dopt-06fac3b0fae017c99",
"enable_dns_hostnames": false,
"enable_dns_support": true,
"enable_network_address_usage_metrics": false,
"filter": [
{
"name": "tag:Name",
"values": [
"VPC"
]
}
],
"id": "vpc-08da87242304c9723",
"instance_tenancy": "default",
"ipv6_association_id": "",
"ipv6_cidr_block": "",
"main_route_table_id": "rtb-06b8cc99d46258d59",
"owner_id": "920373009484",
"state": null,
"tags": {
"Name": "VPC"
},
"timeouts": null
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_vpc",
......@@ -172,6 +400,127 @@
}
]
},
{
"mode": "managed",
"type": "aws_db_instance",
"name": "mydb",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 2,
"attributes": {
"address": "kennethhugo-dev-rds-instance.cx4q20s8stp5.eu-west-3.rds.amazonaws.com",
"allocated_storage": 5,
"allow_major_version_upgrade": null,
"apply_immediately": false,
"arn": "arn:aws:rds:eu-west-3:920373009484:db:kennethhugo-dev-rds-instance",
"auto_minor_version_upgrade": true,
"availability_zone": "eu-west-3a",
"backup_retention_period": 0,
"backup_target": "region",
"backup_window": "08:12-08:42",
"blue_green_update": [],
"ca_cert_identifier": "rds-ca-rsa2048-g1",
"character_set_name": "",
"copy_tags_to_snapshot": false,
"custom_iam_instance_profile": "",
"customer_owned_ip_enabled": false,
"db_name": "mydb_HK",
"db_subnet_group_name": "kennethhugo_dev_rds_subnet_group",
"dedicated_log_volume": false,
"delete_automated_backups": true,
"deletion_protection": false,
"domain": "",
"domain_auth_secret_arn": "",
"domain_dns_ips": [],
"domain_fqdn": "",
"domain_iam_role_name": "",
"domain_ou": "",
"enabled_cloudwatch_logs_exports": [],
"endpoint": "kennethhugo-dev-rds-instance.cx4q20s8stp5.eu-west-3.rds.amazonaws.com:5432",
"engine": "postgres",
"engine_lifecycle_support": "open-source-rds-extended-support",
"engine_version": "14.15",
"engine_version_actual": "14.15",
"final_snapshot_identifier": null,
"hosted_zone_id": "ZMESEXB7ZGGQ3",
"iam_database_authentication_enabled": false,
"id": "db-OVJD44ND4UJCBJPN7LPVEZT6CE",
"identifier": "kennethhugo-dev-rds-instance",
"identifier_prefix": "",
"instance_class": "db.t3.micro",
"iops": 0,
"kms_key_id": "",
"latest_restorable_time": "",
"license_model": "postgresql-license",
"listener_endpoint": [],
"maintenance_window": "sun:05:13-sun:05:43",
"manage_master_user_password": null,
"master_user_secret": [],
"master_user_secret_kms_key_id": null,
"max_allocated_storage": 0,
"monitoring_interval": 0,
"monitoring_role_arn": "",
"multi_az": false,
"nchar_character_set_name": "",
"network_type": "IPV4",
"option_group_name": "default:postgres-14",
"parameter_group_name": "default.postgres14",
"password": "mysecretpassword",
"performance_insights_enabled": false,
"performance_insights_kms_key_id": "",
"performance_insights_retention_period": 0,
"port": 5432,
"publicly_accessible": false,
"replica_mode": "",
"replicas": [],
"replicate_source_db": "",
"resource_id": "db-OVJD44ND4UJCBJPN7LPVEZT6CE",
"restore_to_point_in_time": [],
"s3_import": [],
"skip_final_snapshot": true,
"snapshot_identifier": null,
"status": "available",
"storage_encrypted": false,
"storage_throughput": 0,
"storage_type": "gp2",
"tags": {
"Name": "KENNETHHUGO_DEV_RDS_INSTANCE"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_RDS_INSTANCE"
},
"timeouts": null,
"timezone": "",
"upgrade_storage_config": null,
"username": "postgres",
"vpc_security_group_ids": [
"sg-0501c21c134e1b1e5"
]
},
"sensitive_attributes": [
[
{
"type": "get_attr",
"value": "password"
}
]
],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAwLCJkZWxldGUiOjM2MDAwMDAwMDAwMDAsInVwZGF0ZSI6NDgwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMiJ9",
"dependencies": [
"aws_db_subnet_group.this",
"aws_security_group.sg_api",
"aws_security_group.sg_client",
"aws_security_group.sg_rds",
"aws_subnet.private_subnet_a",
"aws_subnet.private_subnet_b",
"data.aws_availability_zones.available",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_db_subnet_group",
......@@ -187,8 +536,8 @@
"name": "kennethhugo_dev_rds_subnet_group",
"name_prefix": "",
"subnet_ids": [
"subnet-05a7ea15f5fbd3e4b",
"subnet-098844236bb248009"
"subnet-0052f34d50c7c6db5",
"subnet-063715ef5e9c6cb64"
],
"supported_network_types": [
"IPV4"
......@@ -222,7 +571,7 @@
"schema_version": 1,
"attributes": {
"ami": "ami-03f3bb80e24b71cd8",
"arn": "arn:aws:ec2:eu-west-3:920373009484:instance/i-0f8f755ae35c0dba8",
"arn": "arn:aws:ec2:eu-west-3:920373009484:instance/i-04e9a490e913eb4aa",
"associate_public_ip_address": false,
"availability_zone": "eu-west-3a",
"capacity_reservation_specification": [
......@@ -261,7 +610,7 @@
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-0f8f755ae35c0dba8",
"id": "i-04e9a490e913eb4aa",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
......@@ -269,7 +618,7 @@
"instance_type": "t2.micro",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "",
"key_name": "kennethhugo_key",
"launch_template": [],
"maintenance_options": [
{
......@@ -291,8 +640,8 @@
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-047b370670f880b31",
"private_dns": "ip-10-0-35-86.eu-west-3.compute.internal",
"primary_network_interface_id": "eni-043877caa26c09fd3",
"private_dns": "ip-10-0-35-75.eu-west-3.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": false,
......@@ -300,7 +649,7 @@
"hostname_type": "ip-name"
}
],
"private_ip": "10.0.35.86",
"private_ip": "10.0.35.75",
"public_dns": "",
"public_ip": "",
"root_block_device": [
......@@ -313,7 +662,7 @@
"tags": {},
"tags_all": {},
"throughput": 0,
"volume_id": "vol-0d1da72e9c08a0cfd",
"volume_id": "vol-0018f0ca34c3fd476",
"volume_size": 8,
"volume_type": "gp2"
}
......@@ -322,7 +671,7 @@
"security_groups": [],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-098844236bb248009",
"subnet_id": "subnet-063715ef5e9c6cb64",
"tags": {
"Name": "KENNETHHUGO_DEV_API_VM"
},
......@@ -336,17 +685,19 @@
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-05f936ba39fe9b5df"
"sg-08abb0531ca48d02b"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"aws_key_pair.ec2",
"aws_security_group.sg_api",
"aws_security_group.sg_client",
"aws_subnet.private_subnet_a",
"data.aws_ami.amazon_linux_2",
"data.aws_availability_zones.available",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
......@@ -362,7 +713,7 @@
"schema_version": 1,
"attributes": {
"ami": "ami-03f3bb80e24b71cd8",
"arn": "arn:aws:ec2:eu-west-3:920373009484:instance/i-00ce58fcfd7cbeebb",
"arn": "arn:aws:ec2:eu-west-3:920373009484:instance/i-02e813c204183c9ab",
"associate_public_ip_address": false,
"availability_zone": "eu-west-3a",
"capacity_reservation_specification": [
......@@ -401,7 +752,7 @@
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-00ce58fcfd7cbeebb",
"id": "i-02e813c204183c9ab",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
......@@ -409,7 +760,7 @@
"instance_type": "t2.micro",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "",
"key_name": "kennethhugo_key",
"launch_template": [],
"maintenance_options": [
{
......@@ -431,8 +782,8 @@
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-0951f25c7b057616e",
"private_dns": "ip-10-0-35-191.eu-west-3.compute.internal",
"primary_network_interface_id": "eni-0ac8c529a1deb3ebb",
"private_dns": "ip-10-0-35-59.eu-west-3.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": false,
......@@ -440,7 +791,7 @@
"hostname_type": "ip-name"
}
],
"private_ip": "10.0.35.191",
"private_ip": "10.0.35.59",
"public_dns": "",
"public_ip": "",
"root_block_device": [
......@@ -453,7 +804,7 @@
"tags": {},
"tags_all": {},
"throughput": 0,
"volume_id": "vol-01f8994af25befaff",
"volume_id": "vol-0ef9ef21efc35bacc",
"volume_size": 8,
"volume_type": "gp2"
}
......@@ -462,7 +813,7 @@
"security_groups": [],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-098844236bb248009",
"subnet_id": "subnet-063715ef5e9c6cb64",
"tags": {
"Name": "KENNETHHUGO_DEV_CLIENT_VM"
},
......@@ -476,21 +827,84 @@
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-043047f953fdfcc59"
"sg-046489925f564ec8c"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"aws_key_pair.ec2",
"aws_security_group.sg_client",
"aws_subnet.private_subnet_a",
"data.aws_ami.amazon_linux_2",
"data.aws_availability_zones.available",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_key_pair",
"name": "ec2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:key-pair/kennethhugo_key",
"fingerprint": "a0:93:64:56:10:f9:c5:24:e8:83:68:f5:4f:db:83:fd",
"id": "kennethhugo_key",
"key_name": "kennethhugo_key",
"key_name_prefix": "",
"key_pair_id": "key-04e026cd6bf95d78f",
"key_type": "rsa",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCdgUoVRIPCQHlBoaz6UfrvQ4gw2sxeV3PIgCmCSXUW+I9beSfrBs4ELbiuUsV33Y8rKRNQBxa60+J0bEwNtIXRARN7bfdVmukoIJ/LBPcj1XzjmcVE4RJCxSRQbiMYnbUG6Ps5m1sMXsGf0WoPuXIsYoRKHa4QtcqSqqm/G/BW4a0Kvwdfww2dYCKhNoniSPAnDGPowQpGzTc3nvO/ED7polY9T1b6kqaw5WSCWic/qUfgJ2Lxn+bus72vgelhqZhFSqJgTL2e3xPmqtmrUO/4U2kjF3YH120syEfvQFIg/PozQqfkupbDPB1Cx7/1ThZLpJT5Dv1I/kCuZQuNNZj7",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ=="
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "ec2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-021210d8e4366b0bd",
"description": "ec2 Security Group",
"egress": [],
"id": "sg-021210d8e4366b0bd",
"ingress": [],
"name": "KENNETHHUGO_SG_EC2",
"name_prefix": "",
"owner_id": "920373009484",
"revoke_rules_on_delete": false,
"tags": {
"Name": "KENNETHHUGO_SG_EC2"
},
"tags_all": {
"Name": "KENNETHHUGO_SG_EC2"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=",
"dependencies": [
"data.aws_vpc.selected"
],
"create_before_destroy": true
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
......@@ -500,24 +914,24 @@
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-05f936ba39fe9b5df",
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-08abb0531ca48d02b",
"description": "Managed by Terraform",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"description": "Allow traffic to RDS (5432)",
"from_port": 5432,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 0
"to_port": 5432
}
],
"id": "sg-05f936ba39fe9b5df",
"id": "sg-08abb0531ca48d02b",
"ingress": [
{
"cidr_blocks": [],
......@@ -527,7 +941,8 @@
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [
"sg-043047f953fdfcc59"
"sg-046489925f564ec8c",
"sg-0a7ccf14d1b6468fa"
],
"self": false,
"to_port": 5000
......@@ -550,6 +965,7 @@
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=",
"dependencies": [
"aws_security_group.sg_client",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
......@@ -564,35 +980,33 @@
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-043047f953fdfcc59",
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-046489925f564ec8c",
"description": "Managed by Terraform",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"cidr_blocks": [],
"description": "",
"from_port": 0,
"from_port": 80,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 0
"to_port": 80
}
],
"id": "sg-043047f953fdfcc59",
"id": "sg-046489925f564ec8c",
"ingress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"cidr_blocks": [],
"description": "Allow HTTP from anywhere",
"from_port": 80,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"security_groups": [
"sg-0a7ccf14d1b6468fa"
],
"self": false,
"to_port": 80
}
......@@ -613,6 +1027,7 @@
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=",
"dependencies": [
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
......@@ -627,7 +1042,7 @@
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-0201132761d5986da",
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-0501c21c134e1b1e5",
"description": "Managed by Terraform",
"egress": [
{
......@@ -644,7 +1059,7 @@
"to_port": 0
}
],
"id": "sg-0201132761d5986da",
"id": "sg-0501c21c134e1b1e5",
"ingress": [
{
"cidr_blocks": [],
......@@ -654,7 +1069,8 @@
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [
"sg-05f936ba39fe9b5df"
"sg-08abb0531ca48d02b",
"sg-0a7ccf14d1b6468fa"
],
"self": false,
"to_port": 5432
......@@ -678,6 +1094,76 @@
"dependencies": [
"aws_security_group.sg_api",
"aws_security_group.sg_client",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group_rule",
"name": "allow_ec2_to_bastion",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 2,
"attributes": {
"cidr_blocks": null,
"description": null,
"from_port": 22,
"id": "sgrule-2888270446",
"ipv6_cidr_blocks": null,
"prefix_list_ids": null,
"protocol": "tcp",
"security_group_id": "sg-021210d8e4366b0bd",
"security_group_rule_id": "sgr-0bd2166515e8bdb08",
"self": false,
"source_security_group_id": "sg-0a7ccf14d1b6468fa",
"timeouts": null,
"to_port": 22,
"type": "ingress"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjIifQ==",
"dependencies": [
"aws_security_group.ec2",
"data.aws_security_group.bastion",
"data.aws_vpc.selected"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group_rule",
"name": "ssh_api_from_bastion",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 2,
"attributes": {
"cidr_blocks": null,
"description": "SSH from Bastion to API",
"from_port": 22,
"id": "sgrule-922087700",
"ipv6_cidr_blocks": null,
"prefix_list_ids": null,
"protocol": "tcp",
"security_group_id": "sg-08abb0531ca48d02b",
"security_group_rule_id": "sgr-021ea52c24d07985f",
"self": false,
"source_security_group_id": "sg-0a7ccf14d1b6468fa",
"timeouts": null,
"to_port": 22,
"type": "ingress"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjIifQ==",
"dependencies": [
"aws_security_group.sg_api",
"aws_security_group.sg_client",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
......@@ -692,7 +1178,7 @@
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-098844236bb248009",
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-063715ef5e9c6cb64",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3a",
"availability_zone_id": "euw3-az1",
......@@ -702,7 +1188,7 @@
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"id": "subnet-098844236bb248009",
"id": "subnet-063715ef5e9c6cb64",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
......@@ -738,7 +1224,7 @@
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-05a7ea15f5fbd3e4b",
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-0052f34d50c7c6db5",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3b",
"availability_zone_id": "euw3-az2",
......@@ -748,7 +1234,7 @@
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"id": "subnet-05a7ea15f5fbd3e4b",
"id": "subnet-0052f34d50c7c6db5",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
......
{
"version": 4,
"terraform_version": "1.10.5",
"serial": 61,
"serial": 108,
"lineage": "eded4345-a67f-9a4a-9ad8-c68c205f47c2",
"outputs": {},
"resources": [],
"resources": [
{
"mode": "data",
"type": "aws_ami",
"name": "amazon_linux_2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"architecture": "x86_64",
"arn": "arn:aws:ec2:eu-west-3::image/ami-03f3bb80e24b71cd8",
"block_device_mappings": [
{
"device_name": "/dev/xvda",
"ebs": {
"delete_on_termination": "true",
"encrypted": "false",
"iops": "0",
"snapshot_id": "snap-07655f7a65903bcc5",
"throughput": "0",
"volume_size": "8",
"volume_type": "gp2"
},
"no_device": "",
"virtual_name": ""
}
],
"boot_mode": "",
"creation_date": "2025-01-23T03:26:36.000Z",
"deprecation_time": "2025-07-01T00:00:00.000Z",
"description": "Amazon Linux 2 AMI 2.0.20250123.4 x86_64 HVM gp2",
"ena_support": true,
"executable_users": null,
"filter": [
{
"name": "name",
"values": [
"amzn2-ami-hvm*"
]
},
{
"name": "owner-alias",
"values": [
"amazon"
]
}
],
"hypervisor": "xen",
"id": "ami-03f3bb80e24b71cd8",
"image_id": "ami-03f3bb80e24b71cd8",
"image_location": "amazon/amzn2-ami-hvm-2.0.20250123.4-x86_64-gp2",
"image_owner_alias": "amazon",
"image_type": "machine",
"imds_support": "",
"include_deprecated": false,
"kernel_id": "",
"most_recent": true,
"name": "amzn2-ami-hvm-2.0.20250123.4-x86_64-gp2",
"name_regex": null,
"owner_id": "137112412989",
"owners": null,
"platform": "",
"platform_details": "Linux/UNIX",
"product_codes": [],
"public": true,
"ramdisk_id": "",
"root_device_name": "/dev/xvda",
"root_device_type": "ebs",
"root_snapshot_id": "snap-07655f7a65903bcc5",
"sriov_net_support": "simple",
"state": "available",
"state_reason": {
"code": "UNSET",
"message": "UNSET"
},
"tags": {},
"timeouts": null,
"tpm_support": "",
"uefi_data": null,
"usage_operation": "RunInstances",
"virtualization_type": "hvm"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_availability_zones",
"name": "available",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"all_availability_zones": null,
"exclude_names": null,
"exclude_zone_ids": null,
"filter": null,
"group_names": [
"eu-west-3-zg-1"
],
"id": "eu-west-3",
"names": [
"eu-west-3a",
"eu-west-3b",
"eu-west-3c"
],
"state": "available",
"timeouts": null,
"zone_ids": [
"euw3-az1",
"euw3-az2",
"euw3-az3"
]
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_security_group",
"name": "bastion",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-0a7ccf14d1b6468fa",
"description": "ec2 Security Group",
"filter": [
{
"name": "tag:Name",
"values": [
"SG_BASTION_EC2"
]
}
],
"id": "sg-0a7ccf14d1b6468fa",
"name": "SG_BASTION_EC2",
"tags": {
"Name": "SG_BASTION_EC2"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_subnet",
"name": "private-a",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-002aaa6589cef6028",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3a",
"availability_zone_id": "euw3-az1",
"available_ip_address_count": 241,
"cidr_block": "10.0.1.0/24",
"customer_owned_ipv4_pool": "",
"default_for_az": false,
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"filter": [
{
"name": "tag:Name",
"values": [
"PRIVATE_SUBNET_A"
]
}
],
"id": "subnet-002aaa6589cef6028",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": false,
"outpost_arn": "",
"owner_id": "920373009484",
"private_dns_hostname_type_on_launch": "ip-name",
"state": "available",
"tags": {
"Name": "PRIVATE_SUBNET_A",
"Private": "yes"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_subnet",
"name": "private-b",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-0fc06a60f4305264c",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3b",
"availability_zone_id": "euw3-az2",
"available_ip_address_count": 246,
"cidr_block": "10.0.2.0/24",
"customer_owned_ipv4_pool": "",
"default_for_az": false,
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"filter": [
{
"name": "tag:Name",
"values": [
"PRIVATE_SUBNET_B"
]
}
],
"id": "subnet-0fc06a60f4305264c",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": false,
"outpost_arn": "",
"owner_id": "920373009484",
"private_dns_hostname_type_on_launch": "ip-name",
"state": "available",
"tags": {
"Name": "PRIVATE_SUBNET_B",
"Private": "yes"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_subnet",
"name": "public",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-0d9d21b769bca92d7",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3a",
"availability_zone_id": "euw3-az1",
"available_ip_address_count": 248,
"cidr_block": "10.0.0.0/24",
"customer_owned_ipv4_pool": "",
"default_for_az": false,
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"filter": [
{
"name": "tag:Name",
"values": [
"PUBLIC_SUBNET"
]
}
],
"id": "subnet-0d9d21b769bca92d7",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": false,
"outpost_arn": "",
"owner_id": "920373009484",
"private_dns_hostname_type_on_launch": "ip-name",
"state": "available",
"tags": {
"Name": "PUBLIC_SUBNET",
"Private": "no"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_vpc",
"name": "this",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:vpc/vpc-08da87242304c9723",
"cidr_block": "10.0.0.0/16",
"cidr_block_associations": [
{
"association_id": "vpc-cidr-assoc-0fd519069ef9f4ba9",
"cidr_block": "10.0.0.0/16",
"state": "associated"
}
],
"default": false,
"dhcp_options_id": "dopt-06fac3b0fae017c99",
"enable_dns_hostnames": false,
"enable_dns_support": true,
"enable_network_address_usage_metrics": false,
"filter": [
{
"name": "tag:Name",
"values": [
"VPC"
]
}
],
"id": "vpc-08da87242304c9723",
"instance_tenancy": "default",
"ipv6_association_id": "",
"ipv6_cidr_block": "",
"main_route_table_id": "rtb-06b8cc99d46258d59",
"owner_id": "920373009484",
"state": null,
"tags": {
"Name": "VPC"
},
"timeouts": null
},
"sensitive_attributes": []
}
]
},
{
"mode": "managed",
"type": "aws_db_instance",
"name": "mydb",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 2,
"attributes": {
"address": "kennethhugo-dev-rds-instance.cx4q20s8stp5.eu-west-3.rds.amazonaws.com",
"allocated_storage": 5,
"allow_major_version_upgrade": null,
"apply_immediately": false,
"arn": "arn:aws:rds:eu-west-3:920373009484:db:kennethhugo-dev-rds-instance",
"auto_minor_version_upgrade": true,
"availability_zone": "eu-west-3a",
"backup_retention_period": 0,
"backup_target": "region",
"backup_window": "08:12-08:42",
"blue_green_update": [],
"ca_cert_identifier": "rds-ca-rsa2048-g1",
"character_set_name": "",
"copy_tags_to_snapshot": false,
"custom_iam_instance_profile": "",
"customer_owned_ip_enabled": false,
"db_name": "mydb_HK",
"db_subnet_group_name": "kennethhugo_dev_rds_subnet_group",
"dedicated_log_volume": false,
"delete_automated_backups": true,
"deletion_protection": false,
"domain": "",
"domain_auth_secret_arn": "",
"domain_dns_ips": [],
"domain_fqdn": "",
"domain_iam_role_name": "",
"domain_ou": "",
"enabled_cloudwatch_logs_exports": [],
"endpoint": "kennethhugo-dev-rds-instance.cx4q20s8stp5.eu-west-3.rds.amazonaws.com:5432",
"engine": "postgres",
"engine_lifecycle_support": "open-source-rds-extended-support",
"engine_version": "14.15",
"engine_version_actual": "14.15",
"final_snapshot_identifier": null,
"hosted_zone_id": "ZMESEXB7ZGGQ3",
"iam_database_authentication_enabled": false,
"id": "db-OVJD44ND4UJCBJPN7LPVEZT6CE",
"identifier": "kennethhugo-dev-rds-instance",
"identifier_prefix": "",
"instance_class": "db.t3.micro",
"iops": 0,
"kms_key_id": "",
"latest_restorable_time": "",
"license_model": "postgresql-license",
"listener_endpoint": [],
"maintenance_window": "sun:05:13-sun:05:43",
"manage_master_user_password": null,
"master_user_secret": [],
"master_user_secret_kms_key_id": null,
"max_allocated_storage": 0,
"monitoring_interval": 0,
"monitoring_role_arn": "",
"multi_az": false,
"nchar_character_set_name": "",
"network_type": "IPV4",
"option_group_name": "default:postgres-14",
"parameter_group_name": "default.postgres14",
"password": "mysecretpassword",
"performance_insights_enabled": false,
"performance_insights_kms_key_id": "",
"performance_insights_retention_period": 0,
"port": 5432,
"publicly_accessible": false,
"replica_mode": "",
"replicas": [],
"replicate_source_db": "",
"resource_id": "db-OVJD44ND4UJCBJPN7LPVEZT6CE",
"restore_to_point_in_time": [],
"s3_import": [],
"skip_final_snapshot": true,
"snapshot_identifier": null,
"status": "available",
"storage_encrypted": false,
"storage_throughput": 0,
"storage_type": "gp2",
"tags": {
"Name": "KENNETHHUGO_DEV_RDS_INSTANCE"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_RDS_INSTANCE"
},
"timeouts": null,
"timezone": "",
"upgrade_storage_config": null,
"username": "postgres",
"vpc_security_group_ids": [
"sg-0501c21c134e1b1e5"
]
},
"sensitive_attributes": [
[
{
"type": "get_attr",
"value": "password"
}
]
],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAwLCJkZWxldGUiOjM2MDAwMDAwMDAwMDAsInVwZGF0ZSI6NDgwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMiJ9",
"dependencies": [
"aws_db_subnet_group.this",
"aws_security_group.sg_api",
"aws_security_group.sg_client",
"aws_security_group.sg_rds",
"aws_subnet.private_subnet_a",
"aws_subnet.private_subnet_b",
"data.aws_availability_zones.available",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_db_subnet_group",
"name": "this",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:rds:eu-west-3:920373009484:subgrp:kennethhugo_dev_rds_subnet_group",
"description": "Managed by Terraform",
"id": "kennethhugo_dev_rds_subnet_group",
"name": "kennethhugo_dev_rds_subnet_group",
"name_prefix": "",
"subnet_ids": [
"subnet-0052f34d50c7c6db5",
"subnet-063715ef5e9c6cb64"
],
"supported_network_types": [
"IPV4"
],
"tags": {
"Name": "KENNETHHUGO_DEV_RDS_SUBNET_GROUP"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_RDS_SUBNET_GROUP"
},
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_subnet.private_subnet_a",
"aws_subnet.private_subnet_b",
"data.aws_availability_zones.available",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_instance",
"name": "api",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-03f3bb80e24b71cd8",
"arn": "arn:aws:ec2:eu-west-3:920373009484:instance/i-04e9a490e913eb4aa",
"associate_public_ip_address": false,
"availability_zone": "eu-west-3a",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_options": [
{
"amd_sev_snp": "",
"core_count": 1,
"threads_per_core": 1
}
],
"cpu_threads_per_core": 1,
"credit_specification": [
{
"cpu_credits": "standard"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enable_primary_ipv6": null,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-04e9a490e913eb4aa",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
"instance_state": "running",
"instance_type": "t2.micro",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kennethhugo_key",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_protocol_ipv6": "disabled",
"http_put_response_hop_limit": 1,
"http_tokens": "optional",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-043877caa26c09fd3",
"private_dns": "ip-10-0-35-75.eu-west-3.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": false,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "ip-name"
}
],
"private_ip": "10.0.35.75",
"public_dns": "",
"public_ip": "",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/xvda",
"encrypted": false,
"iops": 100,
"kms_key_id": "",
"tags": {},
"tags_all": {},
"throughput": 0,
"volume_id": "vol-0018f0ca34c3fd476",
"volume_size": 8,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-063715ef5e9c6cb64",
"tags": {
"Name": "KENNETHHUGO_DEV_API_VM"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_API_VM"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-08abb0531ca48d02b"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"aws_key_pair.ec2",
"aws_security_group.sg_api",
"aws_security_group.sg_client",
"aws_subnet.private_subnet_a",
"data.aws_ami.amazon_linux_2",
"data.aws_availability_zones.available",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_instance",
"name": "client",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-03f3bb80e24b71cd8",
"arn": "arn:aws:ec2:eu-west-3:920373009484:instance/i-02e813c204183c9ab",
"associate_public_ip_address": false,
"availability_zone": "eu-west-3a",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_options": [
{
"amd_sev_snp": "",
"core_count": 1,
"threads_per_core": 1
}
],
"cpu_threads_per_core": 1,
"credit_specification": [
{
"cpu_credits": "standard"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enable_primary_ipv6": null,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-02e813c204183c9ab",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
"instance_state": "running",
"instance_type": "t2.micro",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kennethhugo_key",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_protocol_ipv6": "disabled",
"http_put_response_hop_limit": 1,
"http_tokens": "optional",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-0ac8c529a1deb3ebb",
"private_dns": "ip-10-0-35-59.eu-west-3.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": false,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "ip-name"
}
],
"private_ip": "10.0.35.59",
"public_dns": "",
"public_ip": "",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/xvda",
"encrypted": false,
"iops": 100,
"kms_key_id": "",
"tags": {},
"tags_all": {},
"throughput": 0,
"volume_id": "vol-0ef9ef21efc35bacc",
"volume_size": 8,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-063715ef5e9c6cb64",
"tags": {
"Name": "KENNETHHUGO_DEV_CLIENT_VM"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_CLIENT_VM"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-046489925f564ec8c"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"aws_key_pair.ec2",
"aws_security_group.sg_client",
"aws_subnet.private_subnet_a",
"data.aws_ami.amazon_linux_2",
"data.aws_availability_zones.available",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_key_pair",
"name": "ec2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:key-pair/kennethhugo_key",
"fingerprint": "a0:93:64:56:10:f9:c5:24:e8:83:68:f5:4f:db:83:fd",
"id": "kennethhugo_key",
"key_name": "kennethhugo_key",
"key_name_prefix": "",
"key_pair_id": "key-04e026cd6bf95d78f",
"key_type": "rsa",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCdgUoVRIPCQHlBoaz6UfrvQ4gw2sxeV3PIgCmCSXUW+I9beSfrBs4ELbiuUsV33Y8rKRNQBxa60+J0bEwNtIXRARN7bfdVmukoIJ/LBPcj1XzjmcVE4RJCxSRQbiMYnbUG6Ps5m1sMXsGf0WoPuXIsYoRKHa4QtcqSqqm/G/BW4a0Kvwdfww2dYCKhNoniSPAnDGPowQpGzTc3nvO/ED7polY9T1b6kqaw5WSCWic/qUfgJ2Lxn+bus72vgelhqZhFSqJgTL2e3xPmqtmrUO/4U2kjF3YH120syEfvQFIg/PozQqfkupbDPB1Cx7/1ThZLpJT5Dv1I/kCuZQuNNZj7",
"tags": null,
"tags_all": {}
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ=="
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "sg_api",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-08abb0531ca48d02b",
"description": "Managed by Terraform",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "Allow traffic to RDS (5432)",
"from_port": 5432,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 5432
}
],
"id": "sg-08abb0531ca48d02b",
"ingress": [
{
"cidr_blocks": [],
"description": "Allow API requests from client",
"from_port": 5000,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [
"sg-046489925f564ec8c",
"sg-0a7ccf14d1b6468fa"
],
"self": false,
"to_port": 5000
}
],
"name": "KENNETHHUGO_DEV_SG_API",
"name_prefix": "",
"owner_id": "920373009484",
"revoke_rules_on_delete": false,
"tags": {
"Name": "KENNETHHUGO_DEV_SG_API"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_SG_API"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=",
"dependencies": [
"aws_security_group.sg_client",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "sg_client",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-046489925f564ec8c",
"description": "Managed by Terraform",
"egress": [
{
"cidr_blocks": [],
"description": "",
"from_port": 80,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 80
}
],
"id": "sg-046489925f564ec8c",
"ingress": [
{
"cidr_blocks": [],
"description": "Allow HTTP from anywhere",
"from_port": 80,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [
"sg-0a7ccf14d1b6468fa"
],
"self": false,
"to_port": 80
}
],
"name": "KENNETHHUGO_DEV_SG_CLIENT",
"name_prefix": "",
"owner_id": "920373009484",
"revoke_rules_on_delete": false,
"tags": {
"Name": "KENNETHHUGO_DEV_SG_CLIENT"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_SG_CLIENT"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=",
"dependencies": [
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "sg_rds",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:security-group/sg-0501c21c134e1b1e5",
"description": "Managed by Terraform",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
}
],
"id": "sg-0501c21c134e1b1e5",
"ingress": [
{
"cidr_blocks": [],
"description": "Allow Postgres from API",
"from_port": 5432,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [
"sg-08abb0531ca48d02b",
"sg-0a7ccf14d1b6468fa"
],
"self": false,
"to_port": 5432
}
],
"name": "KENNETHHUGO_DEV_SG_RDS",
"name_prefix": "",
"owner_id": "920373009484",
"revoke_rules_on_delete": false,
"tags": {
"Name": "KENNETHHUGO_DEV_SG_RDS"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_SG_RDS"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=",
"dependencies": [
"aws_security_group.sg_api",
"aws_security_group.sg_client",
"data.aws_security_group.bastion",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_subnet",
"name": "private_subnet_a",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-063715ef5e9c6cb64",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3a",
"availability_zone_id": "euw3-az1",
"cidr_block": "10.0.35.0/24",
"customer_owned_ipv4_pool": "",
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"id": "subnet-063715ef5e9c6cb64",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": false,
"outpost_arn": "",
"owner_id": "920373009484",
"private_dns_hostname_type_on_launch": "ip-name",
"tags": {
"Name": "KENNETHHUGO_DEV_PRIVATE_SUBNET_A"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_PRIVATE_SUBNET_A"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"data.aws_availability_zones.available",
"data.aws_vpc.this"
]
}
]
},
{
"mode": "managed",
"type": "aws_subnet",
"name": "private_subnet_b",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:eu-west-3:920373009484:subnet/subnet-0052f34d50c7c6db5",
"assign_ipv6_address_on_creation": false,
"availability_zone": "eu-west-3b",
"availability_zone_id": "euw3-az2",
"cidr_block": "10.0.36.0/24",
"customer_owned_ipv4_pool": "",
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"id": "subnet-0052f34d50c7c6db5",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": true,
"outpost_arn": "",
"owner_id": "920373009484",
"private_dns_hostname_type_on_launch": "ip-name",
"tags": {
"Name": "KENNETHHUGO_DEV_PRIVATE_SUBNET_B"
},
"tags_all": {
"Name": "KENNETHHUGO_DEV_PRIVATE_SUBNET_B"
},
"timeouts": null,
"vpc_id": "vpc-08da87242304c9723"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"data.aws_availability_zones.available",
"data.aws_vpc.this"
]
}
]
}
],
"check_results": null
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment