From 408efc4403a86c9720e3328baff100cf40cf503c Mon Sep 17 00:00:00 2001 From: x p k Date: Sun, 28 Jun 2020 16:12:45 +0800 Subject: [PATCH] NEW: ec2 with ssm instance role --- tf-modulised/ec2-ssm/ec2.tf | 14 ++++++++++++++ tf-modulised/ec2-ssm/provider.tf | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tf-modulised/ec2-ssm/ec2.tf create mode 100644 tf-modulised/ec2-ssm/provider.tf diff --git a/tf-modulised/ec2-ssm/ec2.tf b/tf-modulised/ec2-ssm/ec2.tf new file mode 100644 index 0000000..76763f9 --- /dev/null +++ b/tf-modulised/ec2-ssm/ec2.tf @@ -0,0 +1,14 @@ +resource "aws_instance" "web" { + ami = "ami-49bbfa38" + instance_type = "t3.micro" + key_name = "kfong-aws" + vpc_security_group_ids = ["sg-053612d40f966eec7"] + subnet_id = "subnet-0a4edc273558afaab" + associate_public_ip_address = true + iam_instance_profile = "AmazonSSMRoleForInstancesQuickSetup" + + tags = { + Name = "kf-ssm-test" + ssm-enabled = "yes" + } +} diff --git a/tf-modulised/ec2-ssm/provider.tf b/tf-modulised/ec2-ssm/provider.tf new file mode 100644 index 0000000..843e184 --- /dev/null +++ b/tf-modulised/ec2-ssm/provider.tf @@ -0,0 +1,10 @@ +variable "aws_access_key" {} +variable "aws_secret_key" {} +variable "aws_region" {} + +provider "aws" { + access_key = var.aws_access_key + secret_key = var.aws_secret_key + region = var.aws_region + version = ">= 2.28.1" +}