diff --git a/ex1/base.tf b/ex1/base.tf new file mode 100644 index 0000000..7a8f977 --- /dev/null +++ b/ex1/base.tf @@ -0,0 +1,19 @@ +#QUESTION: Create the instance with name "inst2-studentid" passed in a variable +##################### + +variable "instance-name" { + default = "inst2-cedric" +} + +provider "aws" { + region = "eu-west-2" +} + +resource "aws_instance" "inst2" { + ami = "ami-01a6e31ac994bbc09" + instance_type = "t2.micro" + key_name = "cedric" + tags = { + Name = "${var.instance-name}" + } +} diff --git a/ex1/terraform.tfstate b/ex1/terraform.tfstate new file mode 100644 index 0000000..bbef188 --- /dev/null +++ b/ex1/terraform.tfstate @@ -0,0 +1,95 @@ +{ + "version": 4, + "terraform_version": "0.12.24", + "serial": 1, + "lineage": "6c72ba0d-b930-9f0b-261d-7d992deb49cb", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "aws_instance", + "name": "inst2", + "provider": "provider.aws", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-01a6e31ac994bbc09", + "arn": "arn:aws:ec2:eu-west-2:031660489033:instance/i-04f295267d2a7d302", + "associate_public_ip_address": true, + "availability_zone": "eu-west-2a", + "cpu_core_count": 1, + "cpu_threads_per_core": 1, + "credit_specification": [ + { + "cpu_credits": "standard" + } + ], + "disable_api_termination": false, + "ebs_block_device": [], + "ebs_optimized": false, + "ephemeral_block_device": [], + "get_password_data": false, + "hibernation": false, + "host_id": null, + "iam_instance_profile": "", + "id": "i-04f295267d2a7d302", + "instance_initiated_shutdown_behavior": null, + "instance_state": "running", + "instance_type": "t2.micro", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "cedric", + "metadata_options": [ + { + "http_endpoint": "enabled", + "http_put_response_hop_limit": 1, + "http_tokens": "optional" + } + ], + "monitoring": false, + "network_interface": [], + "network_interface_id": null, + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "primary_network_interface_id": "eni-07f32f67781360cdb", + "private_dns": "ip-172-31-25-46.eu-west-2.compute.internal", + "private_ip": "172.31.25.46", + "public_dns": "ec2-3-8-152-38.eu-west-2.compute.amazonaws.com", + "public_ip": "3.8.152.38", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/xvda", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "volume_id": "vol-04388f6bb0dd7610d", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "security_groups": [ + "default" + ], + "source_dest_check": true, + "subnet_id": "subnet-d9ae3aa3", + "tags": { + "Name": "inst2-cedric" + }, + "tenancy": "default", + "timeouts": null, + "user_data": null, + "user_data_base64": null, + "volume_tags": {}, + "vpc_security_group_ids": [ + "sg-64368d06" + ] + }, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" + } + ] + } + ] +}