From 4a9ceb991c806989a6106c2300470e869817d325 Mon Sep 17 00:00:00 2001 From: Devendra Date: Wed, 19 Jun 2024 15:57:05 +0530 Subject: [PATCH] learn(tf): practising local-exec in dept --- AWS Automation/env.txt | 65 ++++++ AWS Automation/instance.tf | 44 +++- AWS Automation/ip_address.txt | 2 +- AWS Automation/terraform.tfstate | 288 +----------------------- AWS Automation/terraform.tfstate.backup | 288 +++++++++++++++++++++++- 5 files changed, 390 insertions(+), 297 deletions(-) create mode 100644 AWS Automation/env.txt diff --git a/AWS Automation/env.txt b/AWS Automation/env.txt new file mode 100644 index 0000000..e1d464b --- /dev/null +++ b/AWS Automation/env.txt @@ -0,0 +1,65 @@ +GJS_DEBUG_TOPICS=JS ERROR;JS LOG +LESSOPEN=| /usr/bin/lesspipe %s +USER=dev +XDG_SESSION_TYPE=x11 +GIT_ASKPASS=/usr/share/code/resources/app/extensions/git/dist/askpass.sh +host=localhost +SHLVL=1 +HOME=/home/dev +CHROME_DESKTOP=code-url-handler.desktop +TERM_PROGRAM_VERSION=1.90.1 +DESKTOP_SESSION=ubuntu +NVM_BIN=/home/dev/.nvm/versions/node/v20.9.0/bin +NVM_INC=/home/dev/.nvm/versions/node/v20.9.0/include/node +GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/code.desktop +GNOME_SHELL_SESSION_MODE=ubuntu +GTK_MODULES=gail:atk-bridge +VSCODE_GIT_ASKPASS_MAIN=/usr/share/code/resources/app/extensions/git/dist/askpass-main.js +VSCODE_GIT_ASKPASS_NODE=/usr/share/code/code +MANAGERPID=2844 +SYSTEMD_EXEC_PID=3212 +GSM_SKIP_SSH_AGENT_WORKAROUND=true +DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus +COLORTERM=truecolor +GIO_LAUNCHED_DESKTOP_FILE_PID=6887 +NVM_DIR=/home/dev/.nvm +DEBUGINFOD_URLS=https://debuginfod.ubuntu.com +LOGNAME=dev +JOURNAL_STREAM=8:25652 +_=/usr/local/bin/terraform +MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/session.slice/org.gnome.Shell@x11.service/memory.pressure +XDG_SESSION_CLASS=user +USERNAME=dev +TERM=xterm-256color +GNOME_DESKTOP_SESSION_ID=this-is-deprecated +WINDOWPATH=2 +PATH=/home/dev/.nvm/versions/node/v20.9.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/bin:/usr/bin:/usr/bin:/usr/bin +SESSION_MANAGER=local/dev-B85M-D3H:@/tmp/.ICE-unix/3181,unix/dev-B85M-D3H:/tmp/.ICE-unix/3181 +INVOCATION_ID=fb3e46bff8544e66ac1ab89ca0359f21 +XDG_MENU_PREFIX=gnome- +XDG_RUNTIME_DIR=/run/user/1000 +GDK_BACKEND=x11 +DISPLAY=:1 +LANG=en_US.UTF-8 +XDG_CURRENT_DESKTOP=Unity +XMODIFIERS=@im=ibus +XDG_SESSION_DESKTOP=ubuntu +XAUTHORITY=/run/user/1000/gdm/Xauthority +LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90: +VSCODE_GIT_IPC_HANDLE=/run/user/1000/vscode-git-145185e0d2.sock +TERM_PROGRAM=vscode +SSH_AUTH_SOCK=/run/user/1000/keyring/ssh +ORIGINAL_XDG_CURRENT_DESKTOP=ubuntu:GNOME +SHELL=/bin/bash +QT_ACCESSIBILITY=1 +GDMSESSION=ubuntu +LESSCLOSE=/usr/bin/lesspipe %s %s +GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1 +GJS_DEBUG_OUTPUT=stderr +VSCODE_GIT_ASKPASS_EXTRA_ARGS= +QT_IM_MODULE=ibus +PWD=/home/dev/Desktop/Terraform Learning /AWS Automation +XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg +NVM_CD_FLAGS= +XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop +MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA= diff --git a/AWS Automation/instance.tf b/AWS Automation/instance.tf index 84c12ef..4b35392 100644 --- a/AWS Automation/instance.tf +++ b/AWS Automation/instance.tf @@ -7,35 +7,63 @@ resource "aws_instance" "First-TF-Instance" { tags = { Name = "First-TF-Instance" } + # This will run the script.sh file on the EC2 instance user_data = file("${path.module}/script.sh") connection { + # This will connect to the EC2 instance using SSH + # This will use the private key to connect to the EC2 instance + # This will use the ec2-user as the user + # This will use the public IP of the EC2 instance type = "ssh" user = "ec2-user" private_key = file("${path.module}/id_rsa") host = self.public_ip } provisioner "file" { - source = "Readme.MD" - destination = "/tmp/Readme.MD" + source = "Readme.MD" # This file should be in the same directory as the instance.tf file + destination = "/tmp/Readme.MD" # This is the destination path on the EC2 instance } provisioner "file" { - content = "This is test content" + content = "This is test content" # This is the content that will be written to the file destination = "/tmp/Content.MD" } provisioner "file" { - source = "test-folder" + source = "test-folder" # This is the folder that will be copied to the EC2 instance destination = "/tmp/test-folder/" } provisioner "local-exec" { - command = "echo ${self.public_ip} > ip_address.txt " + command = "echo ${self.public_ip} > ip_address.txt " # This will write the public IP of the EC2 instance to the file } + provisioner "local-exec" { - interpreter = [ + interpreter = [ "/usr/bin/python3", "-c" - ] - command = "print('Hello World')" + ] + command = "print('Hello World')" # This will run the python code on the local machine + } + + provisioner "local-exec" { + # This will run only once when the resource is created + # This will create a file with the environment variables + command = "env > env.txt" + environment = { + host = "localhost" + } + } + provisioner "local-exec" { + when = destroy # This will only run when the resource is destroyed + command = "echo 'Destroying...'" + } + + provisioner "local-exec" { + # This will run only once when the resource is created + command = "echo 'Creating Resources...'" + } + } + + diff --git a/AWS Automation/ip_address.txt b/AWS Automation/ip_address.txt index e1f6789..a5cca66 100644 --- a/AWS Automation/ip_address.txt +++ b/AWS Automation/ip_address.txt @@ -1 +1 @@ -13.235.23.207 +3.110.212.213 diff --git a/AWS Automation/terraform.tfstate b/AWS Automation/terraform.tfstate index 1651c03..d6169e6 100644 --- a/AWS Automation/terraform.tfstate +++ b/AWS Automation/terraform.tfstate @@ -1,291 +1,9 @@ { "version": 4, "terraform_version": "1.8.5", - "serial": 129, + "serial": 141, "lineage": "c1e8351c-40a2-09a6-4b89-4bfb8790be4f", - "outputs": { - "keyName": { - "value": "key-tf", - "type": "string" - }, - "securityGroupDetails": { - "value": "sg-0de81d56d0a9710db", - "type": "string" - } - }, - "resources": [ - { - "mode": "managed", - "type": "aws_instance", - "name": "First-TF-Instance", - "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", - "instances": [ - { - "schema_version": 1, - "attributes": { - "ami": "ami-0cc9838aa7ab1dce7", - "arn": "arn:aws:ec2:ap-south-1:454461993352:instance/i-04de51b83d64d2a9b", - "associate_public_ip_address": true, - "availability_zone": "ap-south-1a", - "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, - "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-04de51b83d64d2a9b", - "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": "key-tf", - "launch_template": [], - "maintenance_options": [ - { - "auto_recovery": "default" - } - ], - "metadata_options": [ - { - "http_endpoint": "enabled", - "http_protocol_ipv6": "disabled", - "http_put_response_hop_limit": 2, - "http_tokens": "required", - "instance_metadata_tags": "disabled" - } - ], - "monitoring": false, - "network_interface": [], - "outpost_arn": "", - "password_data": "", - "placement_group": "", - "placement_partition_number": 0, - "primary_network_interface_id": "eni-097ad4c162163c353", - "private_dns": "ip-172-31-42-9.ap-south-1.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": "172.31.42.9", - "public_dns": "ec2-13-235-23-207.ap-south-1.compute.amazonaws.com", - "public_ip": "13.235.23.207", - "root_block_device": [ - { - "delete_on_termination": true, - "device_name": "/dev/xvda", - "encrypted": false, - "iops": 3000, - "kms_key_id": "", - "tags": {}, - "tags_all": {}, - "throughput": 125, - "volume_id": "vol-024c291bfa82971f2", - "volume_size": 8, - "volume_type": "gp3" - } - ], - "secondary_private_ips": [], - "security_groups": [ - "First-TF-SG" - ], - "source_dest_check": true, - "spot_instance_request_id": "", - "subnet_id": "subnet-02b43b320c41e6f85", - "tags": { - "Name": "First-TF-Instance" - }, - "tags_all": { - "Name": "First-TF-Instance" - }, - "tenancy": "default", - "timeouts": null, - "user_data": "ef4e1c30bf399ecc600bf0fff81d77451bc63c69", - "user_data_base64": null, - "user_data_replace_on_change": false, - "volume_tags": null, - "vpc_security_group_ids": [ - "sg-0de81d56d0a9710db" - ] - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", - "dependencies": [ - "aws_key_pair.key-tf", - "aws_security_group.allow_tls" - ] - } - ] - }, - { - "mode": "managed", - "type": "aws_key_pair", - "name": "key-tf", - "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", - "instances": [ - { - "schema_version": 1, - "attributes": { - "arn": "arn:aws:ec2:ap-south-1:454461993352:key-pair/key-tf", - "fingerprint": "e2:55:c2:b2:d4:53:49:3a:41:52:8a:82:b6:07:45:a9", - "id": "key-tf", - "key_name": "key-tf", - "key_name_prefix": "", - "key_pair_id": "key-0d4227afb82b4ca5c", - "key_type": "rsa", - "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC4fWINmsr6W4Jot5PqdKljwA2x3iijFs/NB37ygV74ZoeAUnJ+plrlhuZ3hW9Hty/ZNlHcd6qC+h1q7m6pJR2FYqVdc9xikNx6eTH9I3ssos+5kgP447gpMrA3ap0DBqvt5YjwlcbVQuE3NZIAHUnHV9veil3JjALj/dbzAdXaG7P1vL3lxP72yavRizeeRPfrze2FqMvyDHmiDgo+URIo5DeJu2tJMuPUQ2zwcFWhhI7XolJHoU/CY3Hm9lJM8aGS6J81Hn9yRO1ztAerd7mcwIDUAFU3a6xsfPCDoBe6QA59nTlFSFChabnYH1DfP1Tl5mty+HyQV6kAPZSbzBpPVnhunpQyeEVE3cFkzxHzGM4jlW7WL45FuSHD8u2TVZVOgXJfflCkfXSqQssRRUYS+i5ylzkBhR+YZbhZZ0dOMA8i1OPfpWXT4LZ9Et2MEYnkapGYMnRfw/LDrMWwATB3DgbQle7LKU/wTD0767DrqLBEoUWnU8Q8pwLr/kh52fM= dev@dev-B85M-D3H", - "tags": null, - "tags_all": {} - }, - "sensitive_attributes": [], - "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" - } - ] - }, - { - "mode": "managed", - "type": "aws_security_group", - "name": "allow_tls", - "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", - "instances": [ - { - "schema_version": 1, - "attributes": { - "arn": "arn:aws:ec2:ap-south-1:454461993352:security-group/sg-0de81d56d0a9710db", - "description": "Allow HTTP and SSH inbound traffic", - "egress": [ - { - "cidr_blocks": [ - "0.0.0.0/0" - ], - "description": "", - "from_port": 0, - "ipv6_cidr_blocks": [ - "::/0" - ], - "prefix_list_ids": [], - "protocol": "-1", - "security_groups": [], - "self": false, - "to_port": 0 - } - ], - "id": "sg-0de81d56d0a9710db", - "ingress": [ - { - "cidr_blocks": [ - "0.0.0.0/0" - ], - "description": "TLS from VPC", - "from_port": 22, - "ipv6_cidr_blocks": [], - "prefix_list_ids": [], - "protocol": "tcp", - "security_groups": [], - "self": false, - "to_port": 22 - }, - { - "cidr_blocks": [ - "0.0.0.0/0" - ], - "description": "TLS from VPC", - "from_port": 27017, - "ipv6_cidr_blocks": [], - "prefix_list_ids": [], - "protocol": "tcp", - "security_groups": [], - "self": false, - "to_port": 27017 - }, - { - "cidr_blocks": [ - "0.0.0.0/0" - ], - "description": "TLS from VPC", - "from_port": 3306, - "ipv6_cidr_blocks": [], - "prefix_list_ids": [], - "protocol": "tcp", - "security_groups": [], - "self": false, - "to_port": 3306 - }, - { - "cidr_blocks": [ - "0.0.0.0/0" - ], - "description": "TLS from VPC", - "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": "TLS from VPC", - "from_port": 80, - "ipv6_cidr_blocks": [], - "prefix_list_ids": [], - "protocol": "tcp", - "security_groups": [], - "self": false, - "to_port": 80 - } - ], - "name": "First-TF-SG", - "name_prefix": "", - "owner_id": "454461993352", - "revoke_rules_on_delete": false, - "tags": null, - "tags_all": {}, - "timeouts": null, - "vpc_id": "vpc-0a7f5bb9b38577758" - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=" - } - ] - } - ], + "outputs": {}, + "resources": [], "check_results": null } diff --git a/AWS Automation/terraform.tfstate.backup b/AWS Automation/terraform.tfstate.backup index de4ceca..9fd8f27 100644 --- a/AWS Automation/terraform.tfstate.backup +++ b/AWS Automation/terraform.tfstate.backup @@ -1,9 +1,291 @@ { "version": 4, "terraform_version": "1.8.5", - "serial": 125, + "serial": 137, "lineage": "c1e8351c-40a2-09a6-4b89-4bfb8790be4f", - "outputs": {}, - "resources": [], + "outputs": { + "keyName": { + "value": "key-tf", + "type": "string" + }, + "securityGroupDetails": { + "value": "sg-06cc81e64cd6ae350", + "type": "string" + } + }, + "resources": [ + { + "mode": "managed", + "type": "aws_instance", + "name": "First-TF-Instance", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-0cc9838aa7ab1dce7", + "arn": "arn:aws:ec2:ap-south-1:454461993352:instance/i-0abc0cb9c2f792875", + "associate_public_ip_address": true, + "availability_zone": "ap-south-1a", + "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, + "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-0abc0cb9c2f792875", + "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": "key-tf", + "launch_template": [], + "maintenance_options": [ + { + "auto_recovery": "default" + } + ], + "metadata_options": [ + { + "http_endpoint": "enabled", + "http_protocol_ipv6": "disabled", + "http_put_response_hop_limit": 2, + "http_tokens": "required", + "instance_metadata_tags": "disabled" + } + ], + "monitoring": false, + "network_interface": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-07c66981264937aff", + "private_dns": "ip-172-31-34-84.ap-south-1.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": "172.31.34.84", + "public_dns": "ec2-3-110-212-213.ap-south-1.compute.amazonaws.com", + "public_ip": "3.110.212.213", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/xvda", + "encrypted": false, + "iops": 3000, + "kms_key_id": "", + "tags": {}, + "tags_all": {}, + "throughput": 125, + "volume_id": "vol-0aefea9adb435f962", + "volume_size": 8, + "volume_type": "gp3" + } + ], + "secondary_private_ips": [], + "security_groups": [ + "First-TF-SG" + ], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-02b43b320c41e6f85", + "tags": { + "Name": "First-TF-Instance" + }, + "tags_all": { + "Name": "First-TF-Instance" + }, + "tenancy": "default", + "timeouts": null, + "user_data": "ef4e1c30bf399ecc600bf0fff81d77451bc63c69", + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-06cc81e64cd6ae350" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_key_pair.key-tf", + "aws_security_group.allow_tls" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_key_pair", + "name": "key-tf", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:ap-south-1:454461993352:key-pair/key-tf", + "fingerprint": "e2:55:c2:b2:d4:53:49:3a:41:52:8a:82:b6:07:45:a9", + "id": "key-tf", + "key_name": "key-tf", + "key_name_prefix": "", + "key_pair_id": "key-06311567127a920e6", + "key_type": "rsa", + "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC4fWINmsr6W4Jot5PqdKljwA2x3iijFs/NB37ygV74ZoeAUnJ+plrlhuZ3hW9Hty/ZNlHcd6qC+h1q7m6pJR2FYqVdc9xikNx6eTH9I3ssos+5kgP447gpMrA3ap0DBqvt5YjwlcbVQuE3NZIAHUnHV9veil3JjALj/dbzAdXaG7P1vL3lxP72yavRizeeRPfrze2FqMvyDHmiDgo+URIo5DeJu2tJMuPUQ2zwcFWhhI7XolJHoU/CY3Hm9lJM8aGS6J81Hn9yRO1ztAerd7mcwIDUAFU3a6xsfPCDoBe6QA59nTlFSFChabnYH1DfP1Tl5mty+HyQV6kAPZSbzBpPVnhunpQyeEVE3cFkzxHzGM4jlW7WL45FuSHD8u2TVZVOgXJfflCkfXSqQssRRUYS+i5ylzkBhR+YZbhZZ0dOMA8i1OPfpWXT4LZ9Et2MEYnkapGYMnRfw/LDrMWwATB3DgbQle7LKU/wTD0767DrqLBEoUWnU8Q8pwLr/kh52fM= dev@dev-B85M-D3H", + "tags": null, + "tags_all": {} + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" + } + ] + }, + { + "mode": "managed", + "type": "aws_security_group", + "name": "allow_tls", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:ap-south-1:454461993352:security-group/sg-06cc81e64cd6ae350", + "description": "Allow HTTP and SSH inbound traffic", + "egress": [ + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "", + "from_port": 0, + "ipv6_cidr_blocks": [ + "::/0" + ], + "prefix_list_ids": [], + "protocol": "-1", + "security_groups": [], + "self": false, + "to_port": 0 + } + ], + "id": "sg-06cc81e64cd6ae350", + "ingress": [ + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "TLS from VPC", + "from_port": 22, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 22 + }, + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "TLS from VPC", + "from_port": 27017, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 27017 + }, + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "TLS from VPC", + "from_port": 3306, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 3306 + }, + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "TLS from VPC", + "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": "TLS from VPC", + "from_port": 80, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 80 + } + ], + "name": "First-TF-SG", + "name_prefix": "", + "owner_id": "454461993352", + "revoke_rules_on_delete": false, + "tags": null, + "tags_all": {}, + "timeouts": null, + "vpc_id": "vpc-0a7f5bb9b38577758" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=" + } + ] + } + ], "check_results": null }