Skip to content

Commit

Permalink
learn(tf): learning provisioners
Browse files Browse the repository at this point in the history
  • Loading branch information
Trex-Hub committed Jun 19, 2024
1 parent f0c5e46 commit d72d5b8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
22 changes: 21 additions & 1 deletion AWS Automation/instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,25 @@ resource "aws_instance" "First-TF-Instance" {
tags = {
Name = "First-TF-Instance"
}
user_data =file("${path.module}/script.sh")
user_data = file("${path.module}/script.sh")

connection {
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"
}
provisioner "file" {
content = "This is test content"
destination = "/tmp/Content.MD"
}
provisioner "file" {
source = "test-folder"
destination = "/tmp/test-folder/"
}

}
30 changes: 15 additions & 15 deletions AWS Automation/terraform.tfstate
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": 4,
"terraform_version": "1.8.5",
"serial": 67,
"serial": 105,
"lineage": "c1e8351c-40a2-09a6-4b89-4bfb8790be4f",
"outputs": {
"keyName": {
"value": "key-tf",
"type": "string"
},
"securityGroupDetails": {
"value": "sg-0f720301a65b23bc6",
"value": "sg-0c493d9ce63a3a06f",
"type": "string"
}
},
Expand All @@ -24,7 +24,7 @@
"schema_version": 1,
"attributes": {
"ami": "ami-0cc9838aa7ab1dce7",
"arn": "arn:aws:ec2:ap-south-1:454461993352:instance/i-000ea90ba9f868d8b",
"arn": "arn:aws:ec2:ap-south-1:454461993352:instance/i-0ff237011986a8ea8",
"associate_public_ip_address": true,
"availability_zone": "ap-south-1a",
"capacity_reservation_specification": [
Expand Down Expand Up @@ -62,7 +62,7 @@
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-000ea90ba9f868d8b",
"id": "i-0ff237011986a8ea8",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
Expand Down Expand Up @@ -92,18 +92,18 @@
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-0886c58ac6a018d8f",
"private_dns": "ip-172-31-42-89.ap-south-1.compute.internal",
"primary_network_interface_id": "eni-0fd429046b8c821e8",
"private_dns": "ip-172-31-38-63.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.89",
"public_dns": "ec2-13-235-133-84.ap-south-1.compute.amazonaws.com",
"public_ip": "13.235.133.84",
"private_ip": "172.31.38.63",
"public_dns": "ec2-13-127-41-61.ap-south-1.compute.amazonaws.com",
"public_ip": "13.127.41.61",
"root_block_device": [
{
"delete_on_termination": true,
Expand All @@ -114,7 +114,7 @@
"tags": {},
"tags_all": {},
"throughput": 125,
"volume_id": "vol-042eda8621c87c905",
"volume_id": "vol-07bcc49968af98230",
"volume_size": 8,
"volume_type": "gp3"
}
Expand All @@ -134,12 +134,12 @@
},
"tenancy": "default",
"timeouts": null,
"user_data": "e95276fef373e43ed1a86ae46edca2934abe2670",
"user_data": "ef4e1c30bf399ecc600bf0fff81d77451bc63c69",
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-0f720301a65b23bc6"
"sg-0c493d9ce63a3a06f"
]
},
"sensitive_attributes": [],
Expand All @@ -165,7 +165,7 @@
"id": "key-tf",
"key_name": "key-tf",
"key_name_prefix": "",
"key_pair_id": "key-0ecd583addb722062",
"key_pair_id": "key-0146f9c0727309d71",
"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,
Expand All @@ -185,7 +185,7 @@
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-south-1:454461993352:security-group/sg-0f720301a65b23bc6",
"arn": "arn:aws:ec2:ap-south-1:454461993352:security-group/sg-0c493d9ce63a3a06f",
"description": "Allow HTTP and SSH inbound traffic",
"egress": [
{
Expand All @@ -204,7 +204,7 @@
"to_port": 0
}
],
"id": "sg-0f720301a65b23bc6",
"id": "sg-0c493d9ce63a3a06f",
"ingress": [
{
"cidr_blocks": [
Expand Down
2 changes: 1 addition & 1 deletion AWS Automation/terraform.tfstate.backup
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 4,
"terraform_version": "1.8.5",
"serial": 63,
"serial": 101,
"lineage": "c1e8351c-40a2-09a6-4b89-4bfb8790be4f",
"outputs": {},
"resources": [],
Expand Down
1 change: 1 addition & 0 deletions AWS Automation/test-folder/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is testing for folder copy

0 comments on commit d72d5b8

Please sign in to comment.