diff --git a/project1/terraform.tfstate b/project1/terraform.tfstate index 0dd0865..21b4466 100644 --- a/project1/terraform.tfstate +++ b/project1/terraform.tfstate @@ -1,181 +1,8 @@ { "version": 4, "terraform_version": "0.12.24", - "serial": 21, + "serial": 24, "lineage": "6efb1875-c719-ba5d-da5b-08b8b95e015f", "outputs": {}, - "resources": [ - { - "mode": "managed", - "type": "aws_instance", - "name": "cedric-instance1", - "provider": "provider.aws", - "instances": [ - { - "schema_version": 1, - "attributes": { - "ami": "ami-01a6e31ac994bbc09", - "arn": "arn:aws:ec2:eu-west-2:031660489033:instance/i-05de7fb7bb5344d0e", - "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-05de7fb7bb5344d0e", - "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-028e3ee75982e4331", - "private_dns": "ip-172-31-21-118.eu-west-2.compute.internal", - "private_ip": "172.31.21.118", - "public_dns": "ec2-18-130-0-243.eu-west-2.compute.amazonaws.com", - "public_ip": "18.130.0.243", - "root_block_device": [ - { - "delete_on_termination": true, - "device_name": "/dev/xvda", - "encrypted": false, - "iops": 100, - "kms_key_id": "", - "volume_id": "vol-0573fb38c464d83f9", - "volume_size": 8, - "volume_type": "gp2" - } - ], - "security_groups": [ - "default" - ], - "source_dest_check": true, - "subnet_id": "subnet-d9ae3aa3", - "tags": { - "Name": "cedric-instance1" - }, - "tenancy": "default", - "timeouts": null, - "user_data": null, - "user_data_base64": null, - "volume_tags": {}, - "vpc_security_group_ids": [ - "sg-64368d06" - ] - }, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" - } - ] - }, - { - "mode": "managed", - "type": "aws_instance", - "name": "cedric-instance2", - "provider": "provider.aws", - "instances": [ - { - "schema_version": 1, - "attributes": { - "ami": "ami-01a6e31ac994bbc09", - "arn": "arn:aws:ec2:eu-west-2:031660489033:instance/i-078e2a848ed2044d6", - "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-078e2a848ed2044d6", - "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-0bc1ed77db79d25df", - "private_dns": "ip-172-31-30-118.eu-west-2.compute.internal", - "private_ip": "172.31.30.118", - "public_dns": "ec2-3-8-134-92.eu-west-2.compute.amazonaws.com", - "public_ip": "3.8.134.92", - "root_block_device": [ - { - "delete_on_termination": true, - "device_name": "/dev/xvda", - "encrypted": false, - "iops": 100, - "kms_key_id": "", - "volume_id": "vol-0e37009c992ca4481", - "volume_size": 8, - "volume_type": "gp2" - } - ], - "security_groups": [ - "default" - ], - "source_dest_check": true, - "subnet_id": "subnet-d9ae3aa3", - "tags": { - "Name": "cedric-instance2" - }, - "tenancy": "default", - "timeouts": null, - "user_data": null, - "user_data_base64": null, - "volume_tags": {}, - "vpc_security_group_ids": [ - "sg-64368d06" - ] - }, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" - } - ] - } - ] + "resources": [] } diff --git a/project3/base.tf b/project3/base.tf index 7753a9c..1e13917 100644 --- a/project3/base.tf +++ b/project3/base.tf @@ -3,6 +3,7 @@ terraform { bucket = "terraformsanofieu" region = "eu-west-2" key = "cedric/project3.tfstate" + dynamodb_table = "terraform-state-lock-cedric" } } @@ -10,6 +11,18 @@ provider "aws" { region = "eu-west-2" } +resource "aws_dynamodb_table" "terraform-state-lock" { + name = "terraform-state-lock-cedric" + hash_key = "LockID" + write_capacity = 20 + read_capacity = 20 + + attribute { + name = "LockID" + type = "S" + } +} + resource "aws_instance" "cedric-instance3" { ami = "ami-01a6e31ac994bbc09" instance_type = "t2.micro"