· 9 years ago · Jan 27, 2017, 12:28 AM
1provider "aws" {
2 access_key = "AAAAAAAAAAAAAAAAAAAAAAAA"
3 secret_key = "SSSSSSSSSSSSSSSSS"
4 region = "eu-west-2"
5 skip_credentials_validation = true
6 skip_region_validation = true
7 endpoins {
8 ec2 = "fcu.eu-west-2.outscale.com"
9 }
10}
11
12resource "aws_internet_gateway" "default" {
13 vpc_id = "vpc-5555555"
14}
15
16resource "aws_subnet" "public" {
17 vpc_id = "vpc-5555555"
18
19 cidr_block = "10.0.0.0/24"
20 availability_zone = "eu-west-2a"
21}
22
23
24resource "aws_security_group" "bastion" {
25 name = "bastion"
26 description = "Allow SSH traffic from the internet"
27
28 ingress {
29 from_port = 22
30 to_port = 22
31 protocol = "tcp"
32 cidr_blocks = ["0.0.0.0/0"]
33 }
34
35 vpc_id = "vpc-5555555"
36}
37
38resource "aws_instance" "bastion" {
39 ami = "am-2222222"
40 availability_zone = "eu-west-2a"
41 instance_type = "t2.micro"
42 key_name = "yolo"
43 vpc_security_group_ids = ["${aws_security_group.bastion.id}"]
44 subnet_id = "${aws_subnet.public.id}"
45}
46
47resource "aws_eip" "bastion" {
48 instance = "${aws_instance.bastion.network_interface_id}"
49 vpc = true
50}