1
0
Fork 0

exercice on variables

This commit is contained in:
Cedric Girard 2020-05-12 12:06:28 +02:00
parent ec14136179
commit 0b5c77390a
Signed by: X-dark
GPG Key ID: E7D0E125DB9519E4
2 changed files with 114 additions and 0 deletions

19
ex1/base.tf Normal file
View File

@ -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}"
}
}

95
ex1/terraform.tfstate Normal file
View File

@ -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=="
}
]
}
]
}