diff options
| author | mokha <mokha@cisco.com> | 2018-12-03 14:44:33 -0700 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-12-03 14:44:33 -0700 |
| commit | 35339df374ce6c58098ba72af3c7bd36f64c8dd5 (patch) | |
| tree | 482cbb980ad4eed44bc06923fc5ff0c3c80a6c8b | |
| parent | 524cf2f2ae0661f8b25551aea61965d6525c0d4f (diff) | |
run an inline provisioner.
| -rw-r--r-- | example.tf | 3 | ||||
| -rw-r--r-- | ip_address.txt | 1 | ||||
| -rw-r--r-- | terraform.tfstate | 40 | ||||
| -rw-r--r-- | terraform.tfstate.backup | 198 |
4 files changed, 27 insertions, 215 deletions
@@ -13,6 +13,9 @@ resource "aws_instance" "example" { ami = "ami-b374d5a5" instance_type = "t2.micro" depends_on = ["aws_s3_bucket.example"] + provisioner "local-exec" { + command = "echo ${aws_instance.example.public_ip} > ip_address.txt" + } } resource "aws_eip" "ip" { diff --git a/ip_address.txt b/ip_address.txt new file mode 100644 index 0000000..a875214 --- /dev/null +++ b/ip_address.txt @@ -0,0 +1 @@ +52.90.162.40 diff --git a/terraform.tfstate b/terraform.tfstate index ac3a4f9..1a9a7b4 100644 --- a/terraform.tfstate +++ b/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 3, "terraform_version": "0.11.10", - "serial": 8, + "serial": 10, "lineage": "40ff716c-fda7-b182-f6c8-e493c4cc8c9d", "modules": [ { @@ -16,15 +16,15 @@ "aws_instance.example" ], "primary": { - "id": "eipalloc-0fe52fee40cb91716", + "id": "eipalloc-0db5c50b11c1f661b", "attributes": { - "association_id": "eipassoc-0b1cb24bd7a8742de", + "association_id": "eipassoc-0520a8e44d060a8d8", "domain": "vpc", - "id": "eipalloc-0fe52fee40cb91716", - "instance": "i-0454b45d1cb548750", - "network_interface": "eni-0f10aa438079d3a0d", - "private_ip": "172.31.24.255", - "public_ip": "18.235.182.175", + "id": "eipalloc-0db5c50b11c1f661b", + "instance": "i-04b6bceeb34a8e938", + "network_interface": "eni-05baf588be171e7a5", + "private_ip": "172.31.20.38", + "public_ip": "18.210.121.101", "public_ipv4_pool": "amazon", "tags.%": "0", "vpc": "true" @@ -43,12 +43,14 @@ }, "aws_instance.example": { "type": "aws_instance", - "depends_on": [], + "depends_on": [ + "aws_s3_bucket.example" + ], "primary": { - "id": "i-0454b45d1cb548750", + "id": "i-04b6bceeb34a8e938", "attributes": { "ami": "ami-b374d5a5", - "arn": "arn:aws:ec2:us-east-1:798617457475:instance/i-0454b45d1cb548750", + "arn": "arn:aws:ec2:us-east-1:798617457475:instance/i-04b6bceeb34a8e938", "associate_public_ip_address": "true", "availability_zone": "us-east-1c", "cpu_core_count": "1", @@ -61,25 +63,25 @@ "ephemeral_block_device.#": "0", "get_password_data": "false", "iam_instance_profile": "", - "id": "i-0454b45d1cb548750", + "id": "i-04b6bceeb34a8e938", "instance_state": "running", "instance_type": "t2.micro", "ipv6_addresses.#": "0", "key_name": "", "monitoring": "false", "network_interface.#": "0", - "network_interface_id": "eni-0f10aa438079d3a0d", + "network_interface_id": "eni-05baf588be171e7a5", "password_data": "", "placement_group": "", - "primary_network_interface_id": "eni-0f10aa438079d3a0d", - "private_dns": "ip-172-31-24-255.ec2.internal", - "private_ip": "172.31.24.255", - "public_dns": "ec2-18-235-182-175.compute-1.amazonaws.com", - "public_ip": "18.235.182.175", + "primary_network_interface_id": "eni-05baf588be171e7a5", + "private_dns": "ip-172-31-20-38.ec2.internal", + "private_ip": "172.31.20.38", + "public_dns": "ec2-52-90-162-40.compute-1.amazonaws.com", + "public_ip": "52.90.162.40", "root_block_device.#": "1", "root_block_device.0.delete_on_termination": "true", "root_block_device.0.iops": "100", - "root_block_device.0.volume_id": "vol-0039acaddd3fce195", + "root_block_device.0.volume_id": "vol-09bb0bd3a15d66dce", "root_block_device.0.volume_size": "8", "root_block_device.0.volume_type": "gp2", "security_groups.#": "1", diff --git a/terraform.tfstate.backup b/terraform.tfstate.backup index 779e16a..e5e9174 100644 --- a/terraform.tfstate.backup +++ b/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 3, "terraform_version": "0.11.10", - "serial": 8, + "serial": 10, "lineage": "40ff716c-fda7-b182-f6c8-e493c4cc8c9d", "modules": [ { @@ -9,201 +9,7 @@ "root" ], "outputs": {}, - "resources": { - "aws_eip.ip": { - "type": "aws_eip", - "depends_on": [ - "aws_instance.example" - ], - "primary": { - "id": "eipalloc-0fe52fee40cb91716", - "attributes": { - "association_id": "eipassoc-0b1cb24bd7a8742de", - "domain": "vpc", - "id": "eipalloc-0fe52fee40cb91716", - "instance": "i-0454b45d1cb548750", - "network_interface": "eni-0f10aa438079d3a0d", - "private_ip": "172.31.24.255", - "public_ip": "18.235.182.175", - "public_ipv4_pool": "amazon", - "tags.%": "0", - "vpc": "true" - }, - "meta": { - "e2bfb730-ecaa-11e6-8f88-34363bc7c4c0": { - "delete": 180000000000, - "read": 900000000000, - "update": 300000000000 - } - }, - "tainted": false - }, - "deposed": [], - "provider": "provider.aws" - }, - "aws_instance.another": { - "type": "aws_instance", - "depends_on": [], - "primary": { - "id": "i-017eaca5e55dca82b", - "attributes": { - "ami": "ami-b374d5a5", - "arn": "arn:aws:ec2:us-east-1:798617457475:instance/i-017eaca5e55dca82b", - "associate_public_ip_address": "true", - "availability_zone": "us-east-1c", - "cpu_core_count": "1", - "cpu_threads_per_core": "1", - "credit_specification.#": "1", - "credit_specification.0.cpu_credits": "standard", - "disable_api_termination": "false", - "ebs_block_device.#": "0", - "ebs_optimized": "false", - "ephemeral_block_device.#": "0", - "get_password_data": "false", - "iam_instance_profile": "", - "id": "i-017eaca5e55dca82b", - "instance_state": "running", - "instance_type": "t2.micro", - "ipv6_addresses.#": "0", - "key_name": "", - "monitoring": "false", - "network_interface.#": "0", - "network_interface_id": "eni-0b8448223f9d022ae", - "password_data": "", - "placement_group": "", - "primary_network_interface_id": "eni-0b8448223f9d022ae", - "private_dns": "ip-172-31-31-48.ec2.internal", - "private_ip": "172.31.31.48", - "public_dns": "ec2-54-209-248-17.compute-1.amazonaws.com", - "public_ip": "54.209.248.17", - "root_block_device.#": "1", - "root_block_device.0.delete_on_termination": "true", - "root_block_device.0.iops": "100", - "root_block_device.0.volume_id": "vol-02858b4c9db3dd920", - "root_block_device.0.volume_size": "8", - "root_block_device.0.volume_type": "gp2", - "security_groups.#": "1", - "security_groups.3814588639": "default", - "source_dest_check": "true", - "subnet_id": "subnet-6717343e", - "tags.%": "0", - "tenancy": "default", - "volume_tags.%": "0", - "vpc_security_group_ids.#": "1", - "vpc_security_group_ids.3975149506": "sg-6e635a09" - }, - "meta": { - "e2bfb730-ecaa-11e6-8f88-34363bc7c4c0": { - "create": 600000000000, - "delete": 1200000000000, - "update": 600000000000 - }, - "schema_version": "1" - }, - "tainted": false - }, - "deposed": [], - "provider": "provider.aws" - }, - "aws_instance.example": { - "type": "aws_instance", - "depends_on": [], - "primary": { - "id": "i-0454b45d1cb548750", - "attributes": { - "ami": "ami-b374d5a5", - "arn": "arn:aws:ec2:us-east-1:798617457475:instance/i-0454b45d1cb548750", - "associate_public_ip_address": "true", - "availability_zone": "us-east-1c", - "cpu_core_count": "1", - "cpu_threads_per_core": "1", - "credit_specification.#": "1", - "credit_specification.0.cpu_credits": "standard", - "disable_api_termination": "false", - "ebs_block_device.#": "0", - "ebs_optimized": "false", - "ephemeral_block_device.#": "0", - "get_password_data": "false", - "iam_instance_profile": "", - "id": "i-0454b45d1cb548750", - "instance_state": "running", - "instance_type": "t2.micro", - "ipv6_addresses.#": "0", - "key_name": "", - "monitoring": "false", - "network_interface.#": "0", - "network_interface_id": "eni-0f10aa438079d3a0d", - "password_data": "", - "placement_group": "", - "primary_network_interface_id": "eni-0f10aa438079d3a0d", - "private_dns": "ip-172-31-24-255.ec2.internal", - "private_ip": "172.31.24.255", - "public_dns": "ec2-18-235-182-175.compute-1.amazonaws.com", - "public_ip": "18.235.182.175", - "root_block_device.#": "1", - "root_block_device.0.delete_on_termination": "true", - "root_block_device.0.iops": "100", - "root_block_device.0.volume_id": "vol-0039acaddd3fce195", - "root_block_device.0.volume_size": "8", - "root_block_device.0.volume_type": "gp2", - "security_groups.#": "1", - "security_groups.3814588639": "default", - "source_dest_check": "true", - "subnet_id": "subnet-6717343e", - "tags.%": "0", - "tenancy": "default", - "volume_tags.%": "0", - "vpc_security_group_ids.#": "1", - "vpc_security_group_ids.3975149506": "sg-6e635a09" - }, - "meta": { - "e2bfb730-ecaa-11e6-8f88-34363bc7c4c0": { - "create": 600000000000, - "delete": 1200000000000, - "update": 600000000000 - }, - "schema_version": "1" - }, - "tainted": false - }, - "deposed": [], - "provider": "provider.aws" - }, - "aws_s3_bucket.example": { - "type": "aws_s3_bucket", - "depends_on": [], - "primary": { - "id": "mokha-terraform-getting-started-guide", - "attributes": { - "acceleration_status": "", - "acl": "private", - "arn": "arn:aws:s3:::mokha-terraform-getting-started-guide", - "bucket": "mokha-terraform-getting-started-guide", - "bucket_domain_name": "mokha-terraform-getting-started-guide.s3.amazonaws.com", - "bucket_regional_domain_name": "mokha-terraform-getting-started-guide.s3.amazonaws.com", - "cors_rule.#": "0", - "force_destroy": "false", - "hosted_zone_id": "Z3AQBSTGFYJSTF", - "id": "mokha-terraform-getting-started-guide", - "lifecycle_rule.#": "0", - "logging.#": "0", - "region": "us-east-1", - "replication_configuration.#": "0", - "request_payer": "BucketOwner", - "server_side_encryption_configuration.#": "0", - "tags.%": "0", - "versioning.#": "1", - "versioning.0.enabled": "false", - "versioning.0.mfa_delete": "false", - "website.#": "0" - }, - "meta": {}, - "tainted": false - }, - "deposed": [], - "provider": "provider.aws" - } - }, + "resources": {}, "depends_on": [] } ] |
