inspec/test/integration/build/aws.tf
Miles 69434fec48 Use terraform environments to avoid integration test collisions
* When running integration tests with Rakefile use terraform environment based on environment variable INSPEC_TERRAFORM_ENV
** If INSPEC_TERRAFORM_ENV is not provided, a random string will be used
* Use terraform environment as a namespace for AWS artifacts
* Use attribute file for inspec to be aware of the terraform environment used

Signed-off-by: Miles Tjandrawidjaja <miles@tjandrawidjaja.com>
2017-05-06 14:14:53 -04:00

41 lines
950 B
HCL

provider "aws" {}
resource "aws_instance" "example" {
ami = "ami-0d729a60"
instance_type = "t2.micro"
tags {
Name = "${terraform.env}.Example"
X-Project = "inspec"
}
}
resource "aws_iam_user" "mfa_not_enabled_user" {
name = "${terraform.env}.mfa_not_enabled_user"
}
resource "aws_iam_user" "console_password_enabled_user" {
name = "${terraform.env}.console_password_enabled_user"
force_destroy = true
}
resource "aws_iam_user_login_profile" "u" {
user = "${aws_iam_user.console_password_enabled_user.name}"
pgp_key = "${var.login_profile_pgp_key}"
}
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}"
}
output "example_ec2_name" {
value = "${aws_instance.example.tags.Name}"
}
output "example_ec2_id" {
value = "${aws_instance.example.id}"
}