diff --git a/app.py b/app.py index 2b10302955c9180b6eddec58b01ed8bb454bf0f7..e85f831f9d7fd9c2c1ed2e27a5ef2a49b1f0cef7 100644 --- a/app.py +++ b/app.py @@ -5,6 +5,7 @@ from psycopg2 import sql # Informations de connexion à PostgreSQL host = "localhost" # ou l'adresse de votre serveur +#host = "kennethhugo-dev-rds-instance.cx4q20s8stp5.eu-west-3.rds.amazonaws.com" port = 5432 # port par défaut de PostgreSQL user = "postgres" # utilisateur PostgreSQL password = "mysecretpassword" # mot de passe PostgreSQL @@ -44,6 +45,7 @@ app = Flask(__name__, template_folder ="templates") # Configuration de la base de données PostgreSQL app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:mysecretpassword@localhost:5432/mydb' +#app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:mysecretpassword@kennethhugo-dev-rds-instance.cx4q20s8stp5.eu-west-3.rds.amazonaws.com:5432/mydb' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) @@ -156,5 +158,5 @@ def purchase_ephone(): if __name__ == '__main__': - app.run(debug=True) + app.run(debug=True,host ='0.0.0.0',port=5000) diff --git a/terraform_VPC/Kenneth_Hugo.tfplan b/terraform_VPC/Kenneth_Hugo.tfplan index 5f7e74735f71f4d8b0b19f6e870d59e6397ca3ca..46ec23dadb874efb508ae65814372986d1d04167 100644 Binary files a/terraform_VPC/Kenneth_Hugo.tfplan and b/terraform_VPC/Kenneth_Hugo.tfplan differ diff --git a/terraform_VPC/main.tf b/terraform_VPC/main.tf index 3cb4779f2ad0d717435a7081b3c71af95f30d6f4..767c1e94a1df6c1b1a1630ec0d652da99adf76e0 100644 --- a/terraform_VPC/main.tf +++ b/terraform_VPC/main.tf @@ -126,13 +126,23 @@ resource "aws_security_group" "sg_client" { security_groups = [data.aws_security_group.bastion.id] //cidr_blocks = [] + } + ingress { + description = "Allow SSH from anywhere" + from_port = 22 + to_port = 22 + protocol = "tcp" + security_groups = [data.aws_security_group.bastion.id] + //cidr_blocks = [] + } # Autorise l'API en sortie egress { - from_port = 80 - to_port = 80 + from_port = 5000 + to_port = 5000 protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] } tags = { diff --git a/terraform_VPC/terraform.tfstate.d/DEV/.terraform.tfstate.lock.info b/terraform_VPC/terraform.tfstate.d/DEV/.terraform.tfstate.lock.info new file mode 100644 index 0000000000000000000000000000000000000000..190a1ff5a349d2c30fb607ca3fc03dfc2472f166 --- /dev/null +++ b/terraform_VPC/terraform.tfstate.d/DEV/.terraform.tfstate.lock.info @@ -0,0 +1 @@ +{"ID":"b65770f0-f6c2-ae59-3342-df85f35d930b","Operation":"OperationTypeApply","Info":"","Who":"kenneth@MLG","Version":"1.10.5","Created":"2025-01-30T16:55:27.773921195Z","Path":"terraform.tfstate.d/DEV/terraform.tfstate"} \ No newline at end of file diff --git a/terraform_VPC/terraform.tfstate.d/DEV/terraform.tfstate b/terraform_VPC/terraform.tfstate.d/DEV/terraform.tfstate index 6fd285b96406641ef0660d8154f864965858860d..d59d68328de72c5174c3ebf7d459655eb36025b2 100644 --- a/terraform_VPC/terraform.tfstate.d/DEV/terraform.tfstate +++ b/terraform_VPC/terraform.tfstate.d/DEV/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.10.5", - "serial": 240, + "serial": 249, "lineage": "eded4345-a67f-9a4a-9ad8-c68c205f47c2", "outputs": {}, "resources": [ @@ -169,7 +169,7 @@ "assign_ipv6_address_on_creation": false, "availability_zone": "eu-west-3a", "availability_zone_id": "euw3-az1", - "available_ip_address_count": 241, + "available_ip_address_count": 245, "cidr_block": "10.0.1.0/24", "customer_owned_ipv4_pool": "", "default_for_az": false, @@ -219,7 +219,7 @@ "assign_ipv6_address_on_creation": false, "availability_zone": "eu-west-3b", "availability_zone_id": "euw3-az2", - "available_ip_address_count": 246, + "available_ip_address_count": 248, "cidr_block": "10.0.2.0/24", "customer_owned_ipv4_pool": "", "default_for_az": false, @@ -432,11 +432,11 @@ "deletion_protection": false, "domain": "", "domain_auth_secret_arn": "", - "domain_dns_ips": null, + "domain_dns_ips": [], "domain_fqdn": "", "domain_iam_role_name": "", "domain_ou": "", - "enabled_cloudwatch_logs_exports": null, + "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", @@ -856,7 +856,7 @@ "key_pair_id": "key-0dc72c68c6af39fbb", "key_type": "rsa", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCdgUoVRIPCQHlBoaz6UfrvQ4gw2sxeV3PIgCmCSXUW+I9beSfrBs4ELbiuUsV33Y8rKRNQBxa60+J0bEwNtIXRARN7bfdVmukoIJ/LBPcj1XzjmcVE4RJCxSRQbiMYnbUG6Ps5m1sMXsGf0WoPuXIsYoRKHa4QtcqSqqm/G/BW4a0Kvwdfww2dYCKhNoniSPAnDGPowQpGzTc3nvO/ED7polY9T1b6kqaw5WSCWic/qUfgJ2Lxn+bus72vgelhqZhFSqJgTL2e3xPmqtmrUO/4U2kjF3YH120syEfvQFIg/PozQqfkupbDPB1Cx7/1ThZLpJT5Dv1I/kCuZQuNNZj7", - "tags": null, + "tags": {}, "tags_all": {} }, "sensitive_attributes": [], @@ -877,7 +877,21 @@ "description": "ec2 Security Group", "egress": [], "id": "sg-0c5ea597dc0f43e11", - "ingress": [], + "ingress": [ + { + "cidr_blocks": [], + "description": "", + "from_port": 22, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [ + "sg-0a7ccf14d1b6468fa" + ], + "self": false, + "to_port": 22 + } + ], "name": "KENNETHHUGO_SG_EC2", "name_prefix": "", "owner_id": "920373009484", @@ -1006,15 +1020,17 @@ "description": "Managed by Terraform", "egress": [ { - "cidr_blocks": [], + "cidr_blocks": [ + "0.0.0.0/0" + ], "description": "", - "from_port": 80, + "from_port": 5000, "ipv6_cidr_blocks": [], "prefix_list_ids": [], "protocol": "tcp", "security_groups": [], "self": false, - "to_port": 80 + "to_port": 5000 } ], "id": "sg-0d8ac4e5a30387e18", @@ -1031,6 +1047,19 @@ ], "self": false, "to_port": 80 + }, + { + "cidr_blocks": [], + "description": "Allow SSH from anywhere", + "from_port": 22, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [ + "sg-0a7ccf14d1b6468fa" + ], + "self": false, + "to_port": 22 } ], "name": "KENNETHHUGO_DEV_SG_CLIENT", @@ -1174,7 +1203,7 @@ "prefix_list_ids": null, "protocol": "tcp", "security_group_id": "sg-01d8d54afaa2f5990", - "security_group_rule_id": "sgr-09515b862f42d0f70", + "security_group_rule_id": "sgr-0edaa6df0047991bd", "self": false, "source_security_group_id": "sg-0a7ccf14d1b6468fa", "timeouts": null, diff --git a/terraform_VPC/terraform.tfstate.d/DEV/terraform.tfstate.backup b/terraform_VPC/terraform.tfstate.d/DEV/terraform.tfstate.backup index 53997bd89da86c474be22b43ddc76b791c4c30ea..f6c04bc67e10ef5d1b43bc703098201cd8f70418 100644 --- a/terraform_VPC/terraform.tfstate.d/DEV/terraform.tfstate.backup +++ b/terraform_VPC/terraform.tfstate.d/DEV/terraform.tfstate.backup @@ -1,9 +1,1225 @@ { "version": 4, "terraform_version": "1.10.5", - "serial": 228, + "serial": 246, "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": 243, + "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": 247, + "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": 247, + "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", + "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": "13:47-14:17", + "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-BLJUB6CY35LFI47TPFTUAAPAEM", + "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": "fri:01:14-fri:01:44", + "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-BLJUB6CY35LFI47TPFTUAAPAEM", + "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-024d12e63d1848aa9" + ] + }, + "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", + "data.aws_security_group.bastion", + "data.aws_subnet.private-a", + "data.aws_subnet.private-b", + "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-002aaa6589cef6028", + "subnet-0fc06a60f4305264c" + ], + "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": [ + "data.aws_subnet.private-a", + "data.aws_subnet.private-b" + ] + } + ] + }, + { + "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-02e89522bfb642607", + "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-02e89522bfb642607", + "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-0a1ab6f36a391ccd9", + "private_dns": "ip-10-0-1-93.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.1.93", + "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-04ebf95bebb7bd2e6", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-002aaa6589cef6028", + "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-01d8d54afaa2f5990" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_key_pair.ec2", + "aws_security_group.sg_api", + "aws_security_group.sg_client", + "data.aws_ami.amazon_linux_2", + "data.aws_security_group.bastion", + "data.aws_subnet.private-a", + "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-0d38a82ef96bf25c8", + "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-0d38a82ef96bf25c8", + "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-048525466703b6e30", + "private_dns": "ip-10-0-1-17.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.1.17", + "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-0fe139030c8af9988", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-002aaa6589cef6028", + "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-0d8ac4e5a30387e18" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_key_pair.ec2", + "aws_security_group.sg_client", + "data.aws_ami.amazon_linux_2", + "data.aws_security_group.bastion", + "data.aws_subnet.private-a", + "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-0dc72c68c6af39fbb", + "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-0c5ea597dc0f43e11", + "description": "ec2 Security Group", + "egress": [], + "id": "sg-0c5ea597dc0f43e11", + "ingress": [ + { + "cidr_blocks": [], + "description": "", + "from_port": 22, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [ + "sg-0a7ccf14d1b6468fa" + ], + "self": false, + "to_port": 22 + } + ], + "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", + "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-01d8d54afaa2f5990", + "description": "Managed by Terraform", + "egress": [ + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "Allow traffic to RDS (5432)", + "from_port": 443, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 443 + }, + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "Allow traffic to RDS (5432)", + "from_port": 80, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 80 + }, + { + "cidr_blocks": [ + "10.0.1.0/24" + ], + "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-01d8d54afaa2f5990", + "ingress": [ + { + "cidr_blocks": [], + "description": "Allow API requests from client", + "from_port": 5000, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [ + "sg-0a7ccf14d1b6468fa", + "sg-0d8ac4e5a30387e18" + ], + "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_subnet.private-a", + "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-0d8ac4e5a30387e18", + "description": "Managed by Terraform", + "egress": [ + { + "cidr_blocks": [], + "description": "", + "from_port": 5000, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 5000 + } + ], + "id": "sg-0d8ac4e5a30387e18", + "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 + }, + { + "cidr_blocks": [], + "description": "Allow SSH from anywhere", + "from_port": 22, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [ + "sg-0a7ccf14d1b6468fa" + ], + "self": false, + "to_port": 22 + } + ], + "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-024d12e63d1848aa9", + "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-024d12e63d1848aa9", + "ingress": [ + { + "cidr_blocks": [], + "description": "Allow Postgres from API", + "from_port": 5432, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [ + "sg-01d8d54afaa2f5990", + "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_subnet.private-a", + "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-3761056161", + "ipv6_cidr_blocks": null, + "prefix_list_ids": null, + "protocol": "tcp", + "security_group_id": "sg-0c5ea597dc0f43e11", + "security_group_rule_id": "sgr-0b47fae14beb384ea", + "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-3893508927", + "ipv6_cidr_blocks": null, + "prefix_list_ids": null, + "protocol": "tcp", + "security_group_id": "sg-01d8d54afaa2f5990", + "security_group_rule_id": "sgr-0edaa6df0047991bd", + "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_subnet.private-a", + "data.aws_vpc.this" + ] + } + ] + } + ], "check_results": null }