Make ssh key creation, part of infra setup /cc @Acconut

This commit is contained in:
Kevin van Zonneveld 2016-09-30 13:13:20 +02:00
parent 2367557d23
commit 3d2320a0f2
3 changed files with 41 additions and 14 deletions

View File

@ -1,7 +1,7 @@
{ {
"version": 3, "version": 3,
"terraform_version": "0.7.3", "terraform_version": "0.7.3",
"serial": 28, "serial": 29,
"lineage": "deedcad1-a3e9-4e02-9135-c347bbbe0be0", "lineage": "deedcad1-a3e9-4e02-9135-c347bbbe0be0",
"modules": [ "modules": [
{ {
@ -17,38 +17,40 @@
"public_address": { "public_address": {
"sensitive": false, "sensitive": false,
"type": "string", "type": "string",
"value": "ec2-54-166-147-2.compute-1.amazonaws.com" "value": "ec2-54-226-202-57.compute-1.amazonaws.com"
}, },
"public_addresses": { "public_addresses": {
"sensitive": false, "sensitive": false,
"type": "string", "type": "string",
"value": "ec2-54-166-147-2.compute-1.amazonaws.com" "value": "ec2-54-226-202-57.compute-1.amazonaws.com"
} }
}, },
"resources": { "resources": {
"aws_instance.tusd": { "aws_instance.tusd": {
"type": "aws_instance", "type": "aws_instance",
"depends_on": [], "depends_on": [
"aws_key_pair.infra-tusd-main"
],
"primary": { "primary": {
"id": "i-16ef798d", "id": "i-0321c9c5ee19ea8c3",
"attributes": { "attributes": {
"ami": "ami-9bce7af0", "ami": "ami-9bce7af0",
"availability_zone": "us-east-1d", "availability_zone": "us-east-1a",
"disable_api_termination": "false", "disable_api_termination": "false",
"ebs_block_device.#": "0", "ebs_block_device.#": "0",
"ebs_optimized": "false", "ebs_optimized": "false",
"ephemeral_block_device.#": "0", "ephemeral_block_device.#": "0",
"iam_instance_profile": "", "iam_instance_profile": "",
"id": "i-16ef798d", "id": "i-0321c9c5ee19ea8c3",
"instance_state": "running", "instance_state": "running",
"instance_type": "c3.large", "instance_type": "c3.large",
"key_name": "infra-tusd", "key_name": "infra-tusd-main",
"monitoring": "false", "monitoring": "false",
"network_interface_id": "", "network_interface_id": "",
"private_dns": "ip-10-99-128-27.ec2.internal", "private_dns": "ip-10-178-163-38.ec2.internal",
"private_ip": "10.99.128.27", "private_ip": "10.178.163.38",
"public_dns": "ec2-54-166-147-2.compute-1.amazonaws.com", "public_dns": "ec2-54-226-202-57.compute-1.amazonaws.com",
"public_ip": "54.166.147.2", "public_ip": "54.226.202.57",
"root_block_device.#": "1", "root_block_device.#": "1",
"root_block_device.0.delete_on_termination": "true", "root_block_device.0.delete_on_termination": "true",
"root_block_device.0.iops": "100", "root_block_device.0.iops": "100",
@ -71,6 +73,24 @@
"deposed": [], "deposed": [],
"provider": "" "provider": ""
}, },
"aws_key_pair.infra-tusd-main": {
"type": "aws_key_pair",
"depends_on": [],
"primary": {
"id": "infra-tusd-main",
"attributes": {
"id": "infra-tusd-main",
"key_name": "infra-tusd-main",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCBRaeCTrJguFd7Ger1UNO4gY85dbwIKujzhG1U6UNmjMeLbZPrJXjNwOuAw2I6bo6rchtjH3pMAm0XfsAi1DWOaEv2Iu38xJom157b4Ihk23RLGRyzEWQF3XWIX6FGmOWuuy1YDojTVcKvdLXbgy8Kn/b3qBv3Qfrc0F5o6K/MrXbD5MvNqgJGaQUiIxgQllOB9fIq/5HfV1u1xlvih6VJLBx67HxQN+JMdeLifYOLGuJyF4ByqI+1DNjpf/Lu7wNUsoVFAdis5MQ11gT+rrOoMTeZxgj2XJAxl0tUEOBYd0S10kd0w2F9N8RJEI6Qv7Mdo/yIcYhb82tq3AFcGrkl kvz@tusd.freyproject.io"
},
"meta": {
"schema_version": "1"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_record.www": { "aws_route53_record.www": {
"type": "aws_route53_record", "type": "aws_route53_record",
"depends_on": [ "depends_on": [
@ -84,7 +104,7 @@
"id": "Z3IT8X6U91XY1P_master.tus.io_CNAME", "id": "Z3IT8X6U91XY1P_master.tus.io_CNAME",
"name": "master.tus.io", "name": "master.tus.io",
"records.#": "1", "records.#": "1",
"records.3871998453": "ec2-54-166-147-2.compute-1.amazonaws.com", "records.2249160635": "ec2-54-226-202-57.compute-1.amazonaws.com",
"set_identifier": "", "set_identifier": "",
"ttl": "300", "ttl": "300",
"type": "CNAME", "type": "CNAME",

View File

@ -44,10 +44,16 @@ infra output {
} }
} }
infra resource aws_key_pair "infra-tusd-main" {
key_name = "infra-tusd-main"
public_key = "${file("{{{config.global.ssh.publickey_file}}}")}"
}
infra resource aws_instance tusd { infra resource aws_instance tusd {
ami = "${lookup(var.amis, var.region)}" ami = "${lookup(var.amis, var.region)}"
instance_type = "c3.large" instance_type = "c3.large"
key_name = "infra-tusd" key_name = "${aws_key_pair.infra-tusd-main.key_name}"
security_groups = ["fw-tusd-main"] security_groups = ["fw-tusd-main"]
connection { connection {
key_file = "{{{config.global.ssh.privatekey_file}}}" key_file = "{{{config.global.ssh.privatekey_file}}}"

View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCBRaeCTrJguFd7Ger1UNO4gY85dbwIKujzhG1U6UNmjMeLbZPrJXjNwOuAw2I6bo6rchtjH3pMAm0XfsAi1DWOaEv2Iu38xJom157b4Ihk23RLGRyzEWQF3XWIX6FGmOWuuy1YDojTVcKvdLXbgy8Kn/b3qBv3Qfrc0F5o6K/MrXbD5MvNqgJGaQUiIxgQllOB9fIq/5HfV1u1xlvih6VJLBx67HxQN+JMdeLifYOLGuJyF4ByqI+1DNjpf/Lu7wNUsoVFAdis5MQ11gT+rrOoMTeZxgj2XJAxl0tUEOBYd0S10kd0w2F9N8RJEI6Qv7Mdo/yIcYhb82tq3AFcGrkl kvz@tusd.freyproject.io