2017-10-11 00:21:56 +00:00
|
|
|
terraform {
|
|
|
|
required_version = "~> 0.10.0"
|
|
|
|
}
|
|
|
|
|
2017-01-16 15:14:24 +00:00
|
|
|
provider "aws" {}
|
|
|
|
|
|
|
|
resource "aws_instance" "example" {
|
|
|
|
ami = "ami-0d729a60"
|
|
|
|
instance_type = "t2.micro"
|
|
|
|
|
|
|
|
tags {
|
2017-04-29 23:46:53 +00:00
|
|
|
Name = "${terraform.env}.Example"
|
2017-01-16 15:14:24 +00:00
|
|
|
X-Project = "inspec"
|
|
|
|
}
|
|
|
|
}
|
2017-02-01 21:27:10 +00:00
|
|
|
|
|
|
|
resource "aws_iam_user" "mfa_not_enabled_user" {
|
2017-04-29 23:46:53 +00:00
|
|
|
name = "${terraform.env}.mfa_not_enabled_user"
|
2017-02-01 21:27:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_user" "console_password_enabled_user" {
|
2017-04-29 23:46:53 +00:00
|
|
|
name = "${terraform.env}.console_password_enabled_user"
|
2017-02-01 21:27:10 +00:00
|
|
|
force_destroy = true
|
|
|
|
}
|
|
|
|
|
2017-06-13 05:36:43 +00:00
|
|
|
resource "aws_iam_user_login_profile" "user_login_profile" {
|
|
|
|
user = "${aws_iam_user.console_password_enabled_user.name}"
|
|
|
|
pgp_key = "${var.login_profile_pgp_key}"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_user" "access_key_user" {
|
|
|
|
name = "${terraform.env}.access_key_user"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_access_key" "access_key" {
|
|
|
|
user = "${aws_iam_user.access_key_user.name}"
|
|
|
|
pgp_key = "${var.login_profile_pgp_key}"
|
2017-04-15 12:47:16 +00:00
|
|
|
}
|
2017-04-29 23:46:53 +00:00
|
|
|
|
|
|
|
output "mfa_not_enabled_user" {
|
|
|
|
value = "${aws_iam_user.mfa_not_enabled_user.name}"
|
|
|
|
}
|
|
|
|
|
|
|
|
output "console_password_enabled_user" {
|
|
|
|
value = "${aws_iam_user.console_password_enabled_user.name}"
|
|
|
|
}
|
|
|
|
|
2017-06-13 05:36:43 +00:00
|
|
|
output "access_key_user" {
|
|
|
|
value = "${aws_iam_user.access_key_user.name}"
|
|
|
|
}
|
|
|
|
|
2017-04-29 23:46:53 +00:00
|
|
|
output "example_ec2_name" {
|
|
|
|
value = "${aws_instance.example.tags.Name}"
|
|
|
|
}
|
|
|
|
|
|
|
|
output "example_ec2_id" {
|
|
|
|
value = "${aws_instance.example.id}"
|
|
|
|
}
|