Clean Code

This commit is contained in:
dsk-minchulahn
2023-12-19 13:03:29 +09:00
parent 947561ce1d
commit 0273450ff6
4237 changed files with 0 additions and 7447 deletions

View File

@@ -0,0 +1,36 @@
provider "aws" {
region = "ap-northeast-2"
}
resource "aws_s3_bucket" "druid-prod" {
bucket = "druid.kr.datasaker.io"
tags = {
Name = "druid.kr.datasaker.io"
}
}
resource "aws_iam_user" "druid-s3-prod" {
name = "druid-s3-prod"
}
resource "aws_iam_user_policy" "druid-s3-policy" {
name = "druid-s3-policy"
user = aws_iam_user.druid-s3-prod.name
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*",
"s3-object-lambda:*"
],
"Resource": "*"
}
]
}
EOF
}

View File

@@ -0,0 +1,118 @@
{
"version": 4,
"terraform_version": "1.3.1",
"serial": 8,
"lineage": "88958e46-0322-1f4d-59ba-b9b62c65d924",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_iam_user",
"name": "druid-s3-prod",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/druid-s3-prod",
"force_destroy": false,
"id": "druid-s3-prod",
"name": "druid-s3-prod",
"path": "/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TAQSOASXJXC"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user_policy",
"name": "druid-s3-policy",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "druid-s3-prod:druid-s3-policy",
"name": "druid-s3-policy",
"name_prefix": null,
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": [\n \"s3:*\",\n \"s3-object-lambda:*\"\n ],\n \"Resource\": \"*\"\n }\n ]\n}\n",
"user": "druid-s3-prod"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.druid-s3-prod"
]
}
]
},
{
"mode": "managed",
"type": "aws_s3_bucket",
"name": "druid-prod",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"acceleration_status": "",
"acl": null,
"arn": "arn:aws:s3:::druid.kr.datasaker.io",
"bucket": "druid.kr.datasaker.io",
"bucket_domain_name": "druid.kr.datasaker.io.s3.amazonaws.com",
"bucket_prefix": null,
"bucket_regional_domain_name": "druid.kr.datasaker.io.s3.ap-northeast-2.amazonaws.com",
"cors_rule": [],
"force_destroy": false,
"grant": [
{
"id": "132b0c7dc035122c1c1265a1678d5ec5dcb37d81b08544f029b8cf3f659ecad3",
"permissions": [
"FULL_CONTROL"
],
"type": "CanonicalUser",
"uri": ""
}
],
"hosted_zone_id": "Z3W03O7B5YMIYP",
"id": "druid.kr.datasaker.io",
"lifecycle_rule": [],
"logging": [],
"object_lock_configuration": [],
"object_lock_enabled": false,
"policy": "",
"region": "ap-northeast-2",
"replication_configuration": [],
"request_payer": "BucketOwner",
"server_side_encryption_configuration": [],
"tags": {
"Name": "druid.kr.datasaker.io"
},
"tags_all": {
"Name": "druid.kr.datasaker.io"
},
"timeouts": null,
"versioning": [
{
"enabled": false,
"mfa_delete": false
}
],
"website": [],
"website_domain": null,
"website_endpoint": null
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjM2MDAwMDAwMDAwMDAsInJlYWQiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19"
}
]
}
],
"check_results": []
}

View File

@@ -0,0 +1,57 @@
{
"version": 4,
"terraform_version": "1.3.1",
"serial": 4,
"lineage": "88958e46-0322-1f4d-59ba-b9b62c65d924",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_iam_user",
"name": "druid-s3-prod",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/druid-s3-prod",
"force_destroy": false,
"id": "druid-s3-prod",
"name": "druid-s3-prod",
"path": "/",
"permissions_boundary": null,
"tags": null,
"tags_all": {},
"unique_id": "AIDAXMVVF3TAQSOASXJXC"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user_policy",
"name": "druid-s3-policy",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "druid-s3-prod:druid-s3-policy",
"name": "druid-s3-policy",
"name_prefix": null,
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": [\n \"s3:*\",\n \"s3-object-lambda:*\"\n ],\n \"Resource\": \"*\"\n }\n ]\n}\n",
"user": "druid-s3-prod"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.druid-s3-prod"
]
}
]
}
],
"check_results": []
}

View File

@@ -0,0 +1,44 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/archive" {
version = "1.3.0"
constraints = "~> 1.3"
hashes = [
"h1:T3DszgOa/75SiiONgEDRujpN5rSqIw9TvFZXHjpqMB4=",
"zh:115aa6bc7825402a8d4e2e954378a9f48e4fdbeabe081ffd04e0a2f6786159bb",
"zh:21f731ffac20a67615c64a7a8a96949c971ee28ffd5807d8c299faba73b5e273",
"zh:2e81b58e141b175cbf801ade5e87c5db4cb28933216b0547ef32c95500385904",
"zh:3acbb96fd142b4d193dc18861340281249301368029169e346d15410d0572492",
"zh:4346edee0dfe97154b6f28d9ef0fa762131db92b78bbd1b3207945201cb59818",
"zh:93916a84cc6ff6778456dd170a657326c4dd3a86b4434e424a66a87c2535b888",
"zh:ade675c3ac8b9ec91131bac5881fbd4efad46a3683f2fea2efb9493a2c1b9ffb",
"zh:b0a0cb13fc850903aa7a057ae7e06366939b8f347926dce1137cd47b9123ad93",
"zh:d6d838cceffb7f3ff27fb9b51d78fccdef15bd32408f33a726556bfe66315bd3",
"zh:ddc4ac6aea6537f8096ffeb8ff3bca355f0972793184e0f6df120aa6460b4446",
"zh:e0d1213625d40d124bd9570f0d92907416f8d61bc8c389c776e72c0a97020cce",
"zh:eb707b69f9093b97d98e2dece9822852a27849dd1627d35302e8d6b9801407ef",
]
}
provider "registry.terraform.io/hashicorp/aws" {
version = "4.66.1"
hashes = [
"h1:D/qzK7fE3pgdg25W1u5GqI+VILy8UmhzXruz6c8rJ7g=",
"zh:001c707174b7d6bf89a96cf806f925bb852d1a285fb80b81222cbeb4743bcb79",
"zh:19bc6ac0a7fd1c564fd56c536f1743f71a5e7ca724e21ea51a6a79218939733d",
"zh:3dac5c27f40b511239e9fe6f97dc0b6c95f630ba328001820ddc764e766a5ca2",
"zh:49092c92e2565db4cd4c98ec6878386e6957525d3392b63f0d5df4c48a7c1913",
"zh:4f9e2e1d0c5365a4e6689096cc91ba88ca9c0dc7c633377ba674c1dd856b6a9f",
"zh:57e32bb454f2dc17d5631a9559e36188761d8ae95a452478f81f41bb568a3a42",
"zh:678b78ba629dd833f0705ac90630969f514a54013ab9713ce7ceda55fc5ea138",
"zh:8aab1d76348cf2a685f72382cb838a910b77353179e81ab5794b9c45c8fb36a3",
"zh:8b6791bf0948aa8b49258863992a8ad7e7332dcae1a889e86da0e5ab778dc3b6",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:a36f2777452c2cebdaa8a27378416d512ead367acc078a671bb12276dd4bc9dd",
"zh:c492e6f685882fad6481f4793e696d9e1b01aaae419225c2db0a484b632d1cac",
"zh:d4418e0d1d18e321db364a91d7a768e274bb0fb46df9f3cb5b9debb2bb6917b9",
"zh:d5b4310ef2b2ec22ae14cf909deb1231b56bdd79dc2b51e5db4e46a05e0110c4",
"zh:dedfb01e26b34fb61a52b7e953b8bf5d7a69971187e91697b67221298bbed377",
]
}

View File

@@ -0,0 +1,10 @@
provider "aws" {
region = "ap-northeast-2"
}
terraform {
required_providers {
archive = "~> 1.3"
}
}

View File

@@ -0,0 +1,74 @@
locals {
services = {
"CloudWatch" : "cloudwatch",
"CloudTrail" : "cloudtrail",
"Logs" : "logs",
"S3" : "s3",
"Ec2" : "ec2",
"Sqs" : "sqs"
}
}
resource "aws_iam_policy" "read_only" {
for_each = local.services
name = "${each.key}_ReadOnly_Access"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = [
"${each.value}:List*",
"${each.value}:Get*",
"${each.value}:Describe*"
],
Effect = "Allow",
Resource = "*"
}
]
})
}
resource "aws_iam_policy" "full_access" {
for_each = local.services
name = "${each.key}_Full_Access"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = [
"${each.value}:*"
],
Effect = "Allow",
Resource = "*"
}
]
})
}
resource "aws_iam_group" "read_only" {
for_each = local.services
name = "${each.key}_ReadOnly_Access_Group"
}
resource "aws_iam_group_policy_attachment" "read_only" {
for_each = aws_iam_group.read_only
group = each.value.name
policy_arn = aws_iam_policy.read_only[each.key].arn
}
resource "aws_iam_group" "full_access" {
for_each = local.services
name = "${each.key}_Full_Access_Group"
}
resource "aws_iam_group_policy_attachment" "full_access" {
for_each = aws_iam_group.full_access
group = each.value.name
policy_arn = aws_iam_policy.full_access[each.key].arn
}

View File

@@ -0,0 +1,910 @@
{
"version": 4,
"terraform_version": "1.4.6",
"serial": 794,
"lineage": "757d2b20-88b9-4a16-2150-6bd77f71aa53",
"outputs": {
"bypark_password": {
"value": [],
"type": [
"tuple",
[]
],
"sensitive": true
}
},
"resources": [
{
"mode": "managed",
"type": "aws_iam_group",
"name": "full_access",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/CloudTrail_Full_Access_Group",
"id": "CloudTrail_Full_Access_Group",
"name": "CloudTrail_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TA623FQKNMU"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/CloudWatch_Full_Access_Group",
"id": "CloudWatch_Full_Access_Group",
"name": "CloudWatch_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TARP2XD6BSE"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Ec2_Full_Access_Group",
"id": "Ec2_Full_Access_Group",
"name": "Ec2_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAVMNBJPA5W"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Logs_Full_Access_Group",
"id": "Logs_Full_Access_Group",
"name": "Logs_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAY7W4U7VBX"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/S3_Full_Access_Group",
"id": "S3_Full_Access_Group",
"name": "S3_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TA4JNQAGBSN"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Sqs_Full_Access_Group",
"id": "Sqs_Full_Access_Group",
"name": "Sqs_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAUT2BUOIPE"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_group",
"name": "read_only",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/CloudTrail_ReadOnly_Access_Group",
"id": "CloudTrail_ReadOnly_Access_Group",
"name": "CloudTrail_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TATE2W2ZRGY"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/CloudWatch_ReadOnly_Access_Group",
"id": "CloudWatch_ReadOnly_Access_Group",
"name": "CloudWatch_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAVOIAFAJWP"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Ec2_ReadOnly_Access_Group",
"id": "Ec2_ReadOnly_Access_Group",
"name": "Ec2_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAUF5H5H4YY"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Logs_ReadOnly_Access_Group",
"id": "Logs_ReadOnly_Access_Group",
"name": "Logs_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TASWOO4NVD2"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/S3_ReadOnly_Access_Group",
"id": "S3_ReadOnly_Access_Group",
"name": "S3_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TA46ZZ6TCUN"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Sqs_ReadOnly_Access_Group",
"id": "Sqs_ReadOnly_Access_Group",
"name": "Sqs_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TATXM6AF2K3"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_group_policy_attachment",
"name": "full_access",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"group": "CloudTrail_Full_Access_Group",
"id": "CloudTrail_Full_Access_Group-20230808011214157000000007",
"policy_arn": "arn:aws:iam::508259851457:policy/CloudTrail_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"group": "CloudWatch_Full_Access_Group",
"id": "CloudWatch_Full_Access_Group-20230808011214157900000008",
"policy_arn": "arn:aws:iam::508259851457:policy/CloudWatch_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"group": "Ec2_Full_Access_Group",
"id": "Ec2_Full_Access_Group-20230808011214139600000005",
"policy_arn": "arn:aws:iam::508259851457:policy/Ec2_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"group": "Logs_Full_Access_Group",
"id": "Logs_Full_Access_Group-20230808011214142500000006",
"policy_arn": "arn:aws:iam::508259851457:policy/Logs_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"group": "S3_Full_Access_Group",
"id": "S3_Full_Access_Group-20230808011214137700000004",
"policy_arn": "arn:aws:iam::508259851457:policy/S3_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"group": "Sqs_Full_Access_Group",
"id": "Sqs_Full_Access_Group-20230808014232527900000001",
"policy_arn": "arn:aws:iam::508259851457:policy/Sqs_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_group_policy_attachment",
"name": "read_only",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"group": "CloudTrail_ReadOnly_Access_Group",
"id": "CloudTrail_ReadOnly_Access_Group-2023050912453057910000000f",
"policy_arn": "arn:aws:iam::508259851457:policy/CloudTrail_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"group": "CloudWatch_ReadOnly_Access_Group",
"id": "CloudWatch_ReadOnly_Access_Group-20230509124531128500000018",
"policy_arn": "arn:aws:iam::508259851457:policy/CloudWatch_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"group": "Ec2_ReadOnly_Access_Group",
"id": "Ec2_ReadOnly_Access_Group-20230808011213547500000002",
"policy_arn": "arn:aws:iam::508259851457:policy/Ec2_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"group": "Logs_ReadOnly_Access_Group",
"id": "Logs_ReadOnly_Access_Group-20230517065650591300000001",
"policy_arn": "arn:aws:iam::508259851457:policy/Logs_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"group": "S3_ReadOnly_Access_Group",
"id": "S3_ReadOnly_Access_Group-20230808011213547400000001",
"policy_arn": "arn:aws:iam::508259851457:policy/S3_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"group": "Sqs_ReadOnly_Access_Group",
"id": "Sqs_ReadOnly_Access_Group-20230808014232736500000002",
"policy_arn": "arn:aws:iam::508259851457:policy/Sqs_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_policy",
"name": "full_access",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/CloudTrail_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/CloudTrail_Full_Access",
"name": "CloudTrail_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"cloudtrail:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAY6EEPOU6Q",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/CloudWatch_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/CloudWatch_Full_Access",
"name": "CloudWatch_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"cloudwatch:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TA7KKD3MTAA",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Ec2_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Ec2_Full_Access",
"name": "Ec2_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"ec2:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAVWW5CCHNN",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Logs_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Logs_Full_Access",
"name": "Logs_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"logs:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TA4HWZQ45FJ",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/S3_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/S3_Full_Access",
"name": "S3_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"s3:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAQW7UNRK7I",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Sqs_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Sqs_Full_Access",
"name": "Sqs_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"sqs:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAUS3JANM5M",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_policy",
"name": "read_only",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/CloudTrail_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/CloudTrail_ReadOnly_Access",
"name": "CloudTrail_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"cloudtrail:List*\",\"cloudtrail:Get*\",\"cloudtrail:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAYJXM7PDLF",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/CloudWatch_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/CloudWatch_ReadOnly_Access",
"name": "CloudWatch_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"cloudwatch:List*\",\"cloudwatch:Get*\",\"cloudwatch:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAYQGJHTBAW",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Ec2_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Ec2_ReadOnly_Access",
"name": "Ec2_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"ec2:List*\",\"ec2:Get*\",\"ec2:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TA53OJDD2CI",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Logs_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Logs_ReadOnly_Access",
"name": "Logs_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"logs:List*\",\"logs:Get*\",\"logs:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAUQHN5K463",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/S3_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/S3_ReadOnly_Access",
"name": "S3_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:Get*\",\"s3:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAUHGGAQYRH",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Sqs_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Sqs_ReadOnly_Access",
"name": "Sqs_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"sqs:List*\",\"sqs:Get*\",\"sqs:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TA2ODI5SLWY",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user",
"name": "app",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/grafana-cloudwatch",
"force_destroy": false,
"id": "grafana-cloudwatch",
"name": "grafana-cloudwatch",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TA2SX6BGKZ4"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/argo-workflow",
"force_destroy": false,
"id": "argo-workflow",
"name": "argo-workflow",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TAY3JZ3EPXL"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": 2,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/dsk-metering",
"force_destroy": false,
"id": "dsk-metering",
"name": "dsk-metering",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TA2MLW4CM7L"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user",
"name": "dev2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/user1",
"force_destroy": false,
"id": "user1",
"name": "user1",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TA55RL4GOYD"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/user2",
"force_destroy": false,
"id": "user2",
"name": "user2",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TAXFXW2JU3R"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user",
"name": "tmp",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/bypark",
"force_destroy": false,
"id": "bypark",
"name": "bypark",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TAQDL7S4ZC7"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/baekchan",
"force_destroy": false,
"id": "baekchan",
"name": "baekchan",
"path": "/system/",
"permissions_boundary": null,
"tags": null,
"tags_all": {},
"unique_id": "AIDAXMVVF3TAWKKZZNE5B"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user_group_membership",
"name": "app_group_membership",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"groups": [
"CloudTrail_ReadOnly_Access_Group",
"CloudWatch_ReadOnly_Access_Group",
"Logs_ReadOnly_Access_Group"
],
"id": "terraform-20230808014606188700000002",
"user": "grafana-cloudwatch"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.app"
]
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"groups": [
"Ec2_ReadOnly_Access_Group",
"S3_Full_Access_Group"
],
"id": "terraform-20230808014605996800000001",
"user": "argo-workflow"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.app"
]
},
{
"index_key": 2,
"schema_version": 0,
"attributes": {
"groups": [
"S3_Full_Access_Group"
],
"id": "terraform-20230809031434938500000001",
"user": "dsk-metering"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.app"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_user_group_membership",
"name": "tmp_group_membership",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"groups": [
"CloudWatch_ReadOnly_Access_Group",
"S3_Full_Access_Group",
"Sqs_Full_Access_Group"
],
"id": "terraform-20230808015151063800000001",
"user": "bypark"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.tmp"
]
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"groups": [
"CloudWatch_ReadOnly_Access_Group",
"S3_Full_Access_Group"
],
"id": "terraform-20230814023037161800000001",
"user": "baekchan"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.tmp"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_user_login_profile",
"name": "bypark_login",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"encrypted_password": null,
"id": "user1",
"key_fingerprint": null,
"password": "DYSHckbG'7d!4Ko{y}wf",
"password_length": 20,
"password_reset_required": false,
"pgp_key": null,
"user": "user1"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.dev2"
]
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"encrypted_password": null,
"id": "user2",
"key_fingerprint": null,
"password": "58Oi)tsxTWy+i*_N_LVw",
"password_length": 20,
"password_reset_required": null,
"pgp_key": null,
"user": "user2"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.dev2"
]
}
]
}
],
"check_results": null
}

View File

@@ -0,0 +1,856 @@
{
"version": 4,
"terraform_version": "1.4.6",
"serial": 789,
"lineage": "757d2b20-88b9-4a16-2150-6bd77f71aa53",
"outputs": {
"bypark_password": {
"value": [],
"type": [
"tuple",
[]
],
"sensitive": true
}
},
"resources": [
{
"mode": "managed",
"type": "aws_iam_group",
"name": "full_access",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/CloudTrail_Full_Access_Group",
"id": "CloudTrail_Full_Access_Group",
"name": "CloudTrail_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TA623FQKNMU"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/CloudWatch_Full_Access_Group",
"id": "CloudWatch_Full_Access_Group",
"name": "CloudWatch_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TARP2XD6BSE"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Ec2_Full_Access_Group",
"id": "Ec2_Full_Access_Group",
"name": "Ec2_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAVMNBJPA5W"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Logs_Full_Access_Group",
"id": "Logs_Full_Access_Group",
"name": "Logs_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAY7W4U7VBX"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/S3_Full_Access_Group",
"id": "S3_Full_Access_Group",
"name": "S3_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TA4JNQAGBSN"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Sqs_Full_Access_Group",
"id": "Sqs_Full_Access_Group",
"name": "Sqs_Full_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAUT2BUOIPE"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_group",
"name": "read_only",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/CloudTrail_ReadOnly_Access_Group",
"id": "CloudTrail_ReadOnly_Access_Group",
"name": "CloudTrail_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TATE2W2ZRGY"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/CloudWatch_ReadOnly_Access_Group",
"id": "CloudWatch_ReadOnly_Access_Group",
"name": "CloudWatch_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAVOIAFAJWP"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Ec2_ReadOnly_Access_Group",
"id": "Ec2_ReadOnly_Access_Group",
"name": "Ec2_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TAUF5H5H4YY"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Logs_ReadOnly_Access_Group",
"id": "Logs_ReadOnly_Access_Group",
"name": "Logs_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TASWOO4NVD2"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/S3_ReadOnly_Access_Group",
"id": "S3_ReadOnly_Access_Group",
"name": "S3_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TA46ZZ6TCUN"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:group/Sqs_ReadOnly_Access_Group",
"id": "Sqs_ReadOnly_Access_Group",
"name": "Sqs_ReadOnly_Access_Group",
"path": "/",
"unique_id": "AGPAXMVVF3TATXM6AF2K3"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_group_policy_attachment",
"name": "full_access",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"group": "CloudTrail_Full_Access_Group",
"id": "CloudTrail_Full_Access_Group-20230808011214157000000007",
"policy_arn": "arn:aws:iam::508259851457:policy/CloudTrail_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"group": "CloudWatch_Full_Access_Group",
"id": "CloudWatch_Full_Access_Group-20230808011214157900000008",
"policy_arn": "arn:aws:iam::508259851457:policy/CloudWatch_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"group": "Ec2_Full_Access_Group",
"id": "Ec2_Full_Access_Group-20230808011214139600000005",
"policy_arn": "arn:aws:iam::508259851457:policy/Ec2_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"group": "Logs_Full_Access_Group",
"id": "Logs_Full_Access_Group-20230808011214142500000006",
"policy_arn": "arn:aws:iam::508259851457:policy/Logs_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"group": "S3_Full_Access_Group",
"id": "S3_Full_Access_Group-20230808011214137700000004",
"policy_arn": "arn:aws:iam::508259851457:policy/S3_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"group": "Sqs_Full_Access_Group",
"id": "Sqs_Full_Access_Group-20230808014232527900000001",
"policy_arn": "arn:aws:iam::508259851457:policy/Sqs_Full_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.full_access",
"aws_iam_policy.full_access"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_group_policy_attachment",
"name": "read_only",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"group": "CloudTrail_ReadOnly_Access_Group",
"id": "CloudTrail_ReadOnly_Access_Group-2023050912453057910000000f",
"policy_arn": "arn:aws:iam::508259851457:policy/CloudTrail_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"group": "CloudWatch_ReadOnly_Access_Group",
"id": "CloudWatch_ReadOnly_Access_Group-20230509124531128500000018",
"policy_arn": "arn:aws:iam::508259851457:policy/CloudWatch_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"group": "Ec2_ReadOnly_Access_Group",
"id": "Ec2_ReadOnly_Access_Group-20230808011213547500000002",
"policy_arn": "arn:aws:iam::508259851457:policy/Ec2_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"group": "Logs_ReadOnly_Access_Group",
"id": "Logs_ReadOnly_Access_Group-20230517065650591300000001",
"policy_arn": "arn:aws:iam::508259851457:policy/Logs_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"group": "S3_ReadOnly_Access_Group",
"id": "S3_ReadOnly_Access_Group-20230808011213547400000001",
"policy_arn": "arn:aws:iam::508259851457:policy/S3_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"group": "Sqs_ReadOnly_Access_Group",
"id": "Sqs_ReadOnly_Access_Group-20230808014232736500000002",
"policy_arn": "arn:aws:iam::508259851457:policy/Sqs_ReadOnly_Access"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_group.read_only",
"aws_iam_policy.read_only"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_policy",
"name": "full_access",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/CloudTrail_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/CloudTrail_Full_Access",
"name": "CloudTrail_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"cloudtrail:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAY6EEPOU6Q",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/CloudWatch_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/CloudWatch_Full_Access",
"name": "CloudWatch_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"cloudwatch:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TA7KKD3MTAA",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Ec2_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Ec2_Full_Access",
"name": "Ec2_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"ec2:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAVWW5CCHNN",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Logs_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Logs_Full_Access",
"name": "Logs_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"logs:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TA4HWZQ45FJ",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/S3_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/S3_Full_Access",
"name": "S3_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"s3:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAQW7UNRK7I",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Sqs_Full_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Sqs_Full_Access",
"name": "Sqs_Full_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"sqs:*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAUS3JANM5M",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_policy",
"name": "read_only",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": "CloudTrail",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/CloudTrail_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/CloudTrail_ReadOnly_Access",
"name": "CloudTrail_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"cloudtrail:List*\",\"cloudtrail:Get*\",\"cloudtrail:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAYJXM7PDLF",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "CloudWatch",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/CloudWatch_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/CloudWatch_ReadOnly_Access",
"name": "CloudWatch_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"cloudwatch:List*\",\"cloudwatch:Get*\",\"cloudwatch:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAYQGJHTBAW",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Ec2",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Ec2_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Ec2_ReadOnly_Access",
"name": "Ec2_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"ec2:List*\",\"ec2:Get*\",\"ec2:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TA53OJDD2CI",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Logs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Logs_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Logs_ReadOnly_Access",
"name": "Logs_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"logs:List*\",\"logs:Get*\",\"logs:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAUQHN5K463",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "S3",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/S3_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/S3_ReadOnly_Access",
"name": "S3_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:Get*\",\"s3:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TAUHGGAQYRH",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": "Sqs",
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:policy/Sqs_ReadOnly_Access",
"description": "",
"id": "arn:aws:iam::508259851457:policy/Sqs_ReadOnly_Access",
"name": "Sqs_ReadOnly_Access",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"sqs:List*\",\"sqs:Get*\",\"sqs:Describe*\"],\"Effect\":\"Allow\",\"Resource\":\"*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPAXMVVF3TA2ODI5SLWY",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user",
"name": "app",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/grafana-cloudwatch",
"force_destroy": false,
"id": "grafana-cloudwatch",
"name": "grafana-cloudwatch",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TA2SX6BGKZ4"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/argo-workflow",
"force_destroy": false,
"id": "argo-workflow",
"name": "argo-workflow",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TAY3JZ3EPXL"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": 2,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/dsk-metering",
"force_destroy": false,
"id": "dsk-metering",
"name": "dsk-metering",
"path": "/system/",
"permissions_boundary": null,
"tags": null,
"tags_all": {},
"unique_id": "AIDAXMVVF3TA2MLW4CM7L"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user",
"name": "dev2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/user1",
"force_destroy": false,
"id": "user1",
"name": "user1",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TA55RL4GOYD"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/user2",
"force_destroy": false,
"id": "user2",
"name": "user2",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TAXFXW2JU3R"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user",
"name": "tmp",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:user/system/bypark",
"force_destroy": false,
"id": "bypark",
"name": "bypark",
"path": "/system/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AIDAXMVVF3TAQDL7S4ZC7"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "aws_iam_user_group_membership",
"name": "app_group_membership",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"groups": [
"CloudTrail_ReadOnly_Access_Group",
"CloudWatch_ReadOnly_Access_Group",
"Logs_ReadOnly_Access_Group"
],
"id": "terraform-20230808014606188700000002",
"user": "grafana-cloudwatch"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.app"
]
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"groups": [
"Ec2_ReadOnly_Access_Group",
"S3_Full_Access_Group"
],
"id": "terraform-20230808014605996800000001",
"user": "argo-workflow"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.app"
]
},
{
"index_key": 2,
"schema_version": 0,
"attributes": {
"groups": [
"S3_Full_Access_Group"
],
"id": "terraform-20230809031434938500000001",
"user": "dsk-metering"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.app"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_user_group_membership",
"name": "tmp_group_membership",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"groups": [
"S3_Full_Access_Group",
"Sqs_Full_Access_Group"
],
"id": "terraform-20230808015151063800000001",
"user": "bypark"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.tmp"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_user_login_profile",
"name": "bypark_login",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"encrypted_password": null,
"id": "user1",
"key_fingerprint": null,
"password": "DYSHckbG'7d!4Ko{y}wf",
"password_length": 20,
"password_reset_required": false,
"pgp_key": null,
"user": "user1"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_user.dev2"
]
}
]
}
],
"check_results": null
}

View File

@@ -0,0 +1,40 @@
resource "aws_iam_user" "dev2" {
count = length(var.users)
name = var.users[count.index]
path = "/system/"
}
resource "aws_iam_user" "app" {
count = length(var.apps_users)
name = var.apps_users[count.index].name
path = "/system/"
}
resource "aws_iam_user" "tmp" {
count = length(var.tmp_users)
name = var.tmp_users[count.index].name
path = "/system/"
}
resource "aws_iam_user_group_membership" "app_group_membership" {
count = length(var.apps_users)
user = aws_iam_user.app[count.index].name
groups = var.apps_users[count.index].groups
}
resource "aws_iam_user_group_membership" "tmp_group_membership" {
count = length(var.tmp_users)
user = aws_iam_user.tmp[count.index].name
groups = var.tmp_users[count.index].groups
}
resource "aws_iam_user_login_profile" "bypark_login" {
count = length([for user in var.tmp_users : user if user.is_console_user])
user = aws_iam_user.dev2[count.index].name
password_length = 20
}
output "bypark_password" {
value = [for profile in aws_iam_user_login_profile.bypark_login : profile.encrypted_password if profile.user == "bypark"]
sensitive = true
}

View File

@@ -0,0 +1,86 @@
#---------------------------------------------------------------#
# Network ID
variable "VPC_ID" {
default = "vpc-00ba2b0e9ad59f0ed"
}
variable "Network_CIDR" {
default = "172.24.0.0/19"
}
variable "Private_Subnet_ID_1" {
default = "subnet-024f0deda82039fa4"
}
variable "Private_Subnet_ID_2" {
default = "subnet-050d942fa1c46540a"
}
variable "Private_Subnet_ID_3" {
default = "subnet-0946eb806af7377be"
}
variable "Public_Subnet_ID_1" {
default = "subnet-00c363356f133411d"
}
variable "Public_Subnet_ID_2" {
default = "subnet-07aa5e879a262014d"
}
variable "Public_Subnet_ID_3" {
default = "subnet-0073a61bc56a68a3e"
}
variable "users" {
description = "Dev2 users"
type = list(string)
default = ["user1","user2"]
}
variable "apps_users" {
description = "Apps users and their groups"
type = list(object({
name = string
groups = list(string)
}))
default = [
{
name = "grafana-cloudwatch"
groups = ["CloudWatch_ReadOnly_Access_Group", "Logs_ReadOnly_Access_Group", "CloudTrail_ReadOnly_Access_Group"]
},
{
name = "argo-workflow"
groups = ["Ec2_ReadOnly_Access_Group", "S3_Full_Access_Group"]
},
{
name = "dsk-metering"
groups = ["S3_Full_Access_Group"]
}
]
}
variable "tmp_users" {
description = "temp users and their groups"
type = list(object({
name = string
is_console_user = bool
groups = list(string)
}))
default = [
{
name = "bypark",
is_console_user = true,
groups = ["S3_Full_Access_Group", "Sqs_Full_Access_Group", "CloudWatch_ReadOnly_Access_Group"]
},
{
name = "baekchan",
is_console_user = true,
groups = ["S3_Full_Access_Group", "CloudWatch_ReadOnly_Access_Group"]
}
]
}

View File

@@ -0,0 +1,44 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/archive" {
version = "1.3.0"
constraints = "~> 1.3"
hashes = [
"h1:T3DszgOa/75SiiONgEDRujpN5rSqIw9TvFZXHjpqMB4=",
"zh:115aa6bc7825402a8d4e2e954378a9f48e4fdbeabe081ffd04e0a2f6786159bb",
"zh:21f731ffac20a67615c64a7a8a96949c971ee28ffd5807d8c299faba73b5e273",
"zh:2e81b58e141b175cbf801ade5e87c5db4cb28933216b0547ef32c95500385904",
"zh:3acbb96fd142b4d193dc18861340281249301368029169e346d15410d0572492",
"zh:4346edee0dfe97154b6f28d9ef0fa762131db92b78bbd1b3207945201cb59818",
"zh:93916a84cc6ff6778456dd170a657326c4dd3a86b4434e424a66a87c2535b888",
"zh:ade675c3ac8b9ec91131bac5881fbd4efad46a3683f2fea2efb9493a2c1b9ffb",
"zh:b0a0cb13fc850903aa7a057ae7e06366939b8f347926dce1137cd47b9123ad93",
"zh:d6d838cceffb7f3ff27fb9b51d78fccdef15bd32408f33a726556bfe66315bd3",
"zh:ddc4ac6aea6537f8096ffeb8ff3bca355f0972793184e0f6df120aa6460b4446",
"zh:e0d1213625d40d124bd9570f0d92907416f8d61bc8c389c776e72c0a97020cce",
"zh:eb707b69f9093b97d98e2dece9822852a27849dd1627d35302e8d6b9801407ef",
]
}
provider "registry.terraform.io/hashicorp/aws" {
version = "4.57.1"
hashes = [
"h1:rqJN5HwMnJtHIvIzublREIxUibBFYIKyeQcgOov4DUQ=",
"zh:44200c213ddb138df80d2a5ad86c2ebadbb5fd1d08cd7e4fc56ec6dca927659b",
"zh:469e6fe6a9e99e60cb168d32f05e2e9a83cf161f39160d075ff96f7674c510e1",
"zh:6110ba2c15a2268652ec9ea3797dd0216de84ece428055c49eaf9caa2be1ed62",
"zh:62ed7348acca44f64fc087e879e01cfa4e084c7600cc91e8bb7683f8065a9c79",
"zh:7a80e6fa9b35be178bb566093f7984dd6ffb7ad9d40b9dd5d5907f054f0c3e60",
"zh:8793043c8575a598c1a7cbefcb65ee1776b0061eba719098e552a3adc88f3090",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:a777a0082114e273b7b3eb14095a3f6f6e703c1aff61ffb1f0846bb869e6dfc7",
"zh:b060c3b2973097f2087a98ac6aad7c9c89fe80f7cf3027019049feafc3f8305b",
"zh:e7035e74563f4486848ea1feb60852175353790bc374e0e97e241a88dc0908f7",
"zh:eaaa8e9eba09ada41e13116d53d4baece04fead8fcf3eab68cca3a67ed738e18",
"zh:ec52d8f95a84fad8fe1aae169c89d0c54d5401f75caae0869ad8182c6b6db65b",
"zh:f0e33174025b1b57ecfbdd09f2a59c2559ee94d7681e5ae09079e2822ec54ecf",
"zh:f69790a21380e5aab9303a252564737333e1e95b5d25567681630e49b17e3ec7",
"zh:ff6053942c40a99904bd407f3c082c1fa8f927ecce0374566eb7e8ee8145e582",
]
}

View File

@@ -0,0 +1,22 @@
resource "aws_iam_user" "dev2" {
name = "dev2-read"
}
resource "aws_iam_access_key" "dev2_access_key" {
user = aws_iam_user.dev2.name
}
resource "aws_iam_user_login_profile" "dev2_login_profile" {
user = aws_iam_user.dev2.name
password_reset_required = true
}
data "aws_iam_policy" "read-only" {
arn = "arn:aws:iam::aws:policy/ReadOnlyAccess"
}
resource "aws_iam_policy_attachment" "attach-read-only-policy" {
name = "ReadOnlyAccessAttachment"
policy_arn = data.aws_iam_policy.read-only.arn
users = [aws_iam_user.dev2.name]
}

View File

@@ -0,0 +1,10 @@
provider "aws" {
region = "ap-northeast-2"
}
terraform {
required_providers {
archive = "~> 1.3"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,35 @@
#---------------------------------------------------------------#
# Network ID
variable "VPC_ID" {
default = "vpc-00ba2b0e9ad59f0ed"
}
variable "Network_CIDR" {
default = "172.24.0.0/19"
}
variable "Private_Subnet_ID_1" {
default = "subnet-024f0deda82039fa4"
}
variable "Private_Subnet_ID_2" {
default = "subnet-050d942fa1c46540a"
}
variable "Private_Subnet_ID_3" {
default = "subnet-0946eb806af7377be"
}
variable "Public_Subnet_ID_1" {
default = "subnet-00c363356f133411d"
}
variable "Public_Subnet_ID_2" {
default = "subnet-07aa5e879a262014d"
}
variable "Public_Subnet_ID_3" {
default = "subnet-0073a61bc56a68a3e"
}

View File

@@ -0,0 +1,44 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/archive" {
version = "1.3.0"
constraints = "~> 1.3"
hashes = [
"h1:T3DszgOa/75SiiONgEDRujpN5rSqIw9TvFZXHjpqMB4=",
"zh:115aa6bc7825402a8d4e2e954378a9f48e4fdbeabe081ffd04e0a2f6786159bb",
"zh:21f731ffac20a67615c64a7a8a96949c971ee28ffd5807d8c299faba73b5e273",
"zh:2e81b58e141b175cbf801ade5e87c5db4cb28933216b0547ef32c95500385904",
"zh:3acbb96fd142b4d193dc18861340281249301368029169e346d15410d0572492",
"zh:4346edee0dfe97154b6f28d9ef0fa762131db92b78bbd1b3207945201cb59818",
"zh:93916a84cc6ff6778456dd170a657326c4dd3a86b4434e424a66a87c2535b888",
"zh:ade675c3ac8b9ec91131bac5881fbd4efad46a3683f2fea2efb9493a2c1b9ffb",
"zh:b0a0cb13fc850903aa7a057ae7e06366939b8f347926dce1137cd47b9123ad93",
"zh:d6d838cceffb7f3ff27fb9b51d78fccdef15bd32408f33a726556bfe66315bd3",
"zh:ddc4ac6aea6537f8096ffeb8ff3bca355f0972793184e0f6df120aa6460b4446",
"zh:e0d1213625d40d124bd9570f0d92907416f8d61bc8c389c776e72c0a97020cce",
"zh:eb707b69f9093b97d98e2dece9822852a27849dd1627d35302e8d6b9801407ef",
]
}
provider "registry.terraform.io/hashicorp/aws" {
version = "5.5.0"
hashes = [
"h1:WOweXv4ZjePZwdxuzE2UmRWOPhhcQDNxGu2wOcpHFWY=",
"zh:10fe0ef4191323c920c1844f27dbc88114547d5f78fad915c1769c908f40d916",
"zh:565fc7c3a1f42474fa75f143cb8115e11b894ed7fd9973569b00bd429fb92b4e",
"zh:5ba6132b1d442ed679ad8ea89fb5602aa0893e8dcd002a52ab3d76591aa18c8b",
"zh:5c2580630cd5034bae800445074c17950aea17f089bcdae7af637173122f8b03",
"zh:656d77220c6053fd5adb86d3bfb57dd42f98220d81590ffd643156ffeca36608",
"zh:65c7b3e333b734ce641735a23539d4fb392a675a5a9b892e8369781b1f3386a2",
"zh:682d55b2e6e9c40e20d679aa53d561797b1f3450e5187c9f4e8c359b69f06df3",
"zh:79ebc0993d6128819d70dd896cd743e3bab3e3cdc4c02f2a2dbd138471c23179",
"zh:8d44214c738f0410f829e1c761b021c92b3364daf9fcd08097216cc84eaff997",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:a0b1bc008e95c5a7285f5e7dd116ce60ba7a6c1c3bd8ac3e3b63d4e1438d8e49",
"zh:cf40fb60efc5df42fc5716c7e458868251c82fc78b623f12d1bc994b6fcc7ef2",
"zh:cfd8f3f391cddecfc5e44fe57f0633067470e9038517115ba69d8ee533d5d74e",
"zh:d6552490599e02a756e72b7091b591493cee25548ce7120ad05210b4ff2492bd",
"zh:f77dfe665fd4b3d9e36fdc989d7feff4cf6bf17161c0b1a0f25a0fcf402c779d",
]
}

View File

@@ -0,0 +1,32 @@
resource "aws_instance" "dskdemo" {
ami = "ami-0c27244ec9d87b4e8"
instance_type = "t3.small"
key_name = "kp-jay-bastion-datasaker"
vpc_security_group_ids = [aws_security_group.dskdemo-allow-security.id]
availability_zone = "ap-northeast-2c"
subnet_id = var.Public_Subnet_ID_3
root_block_device {
delete_on_termination = true
volume_size = 30
}
tags = {
Name = "dskdemo"
}
}
resource "aws_ebs_volume" "dskdemo_ebs" {
availability_zone = aws_instance.dskdemo.availability_zone
size = 100
tags = {
Name = "dskdemo-ebs"
}
}
resource "aws_volume_attachment" "dskdemo_ebs_attach" {
device_name = "/dev/xvdf"
volume_id = aws_ebs_volume.dskdemo_ebs.id
instance_id = aws_instance.dskdemo.id
}

View File

@@ -0,0 +1,32 @@
resource "aws_instance" "dskdemo2" {
ami = "ami-0c27244ec9d87b4e8"
instance_type = "t3.small"
key_name = "kp-jay-bastion-datasaker"
vpc_security_group_ids = [aws_security_group.dskdemo-allow-security.id]
availability_zone = "ap-northeast-2c"
subnet_id = var.Public_Subnet_ID_3
root_block_device {
delete_on_termination = true
volume_size = 30
}
tags = {
Name = "dskdemo2"
}
}
resource "aws_ebs_volume" "dskdemo2_ebs" {
availability_zone = aws_instance.dskdemo2.availability_zone
size = 100
tags = {
Name = "dskdemo2-ebs"
}
}
resource "aws_volume_attachment" "dskdemo2_ebs_attach" {
device_name = "/dev/xvdf"
volume_id = aws_ebs_volume.dskdemo2_ebs.id
instance_id = aws_instance.dskdemo2.id
}

View File

@@ -0,0 +1,10 @@
provider "aws" {
region = "ap-northeast-2"
}
terraform {
required_providers {
archive = "~> 1.3"
}
}

View File

@@ -0,0 +1,73 @@
resource "aws_security_group" "dskdemo-allow-security" {
name = "dskdemo-allow-security-new"
description = "Allow inbound traffic"
vpc_id = var.VPC_ID
ingress {
description = "SSH"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"]
}
ingress {
description = "etcd"
from_port = 2379
to_port = 2380
protocol = "tcp"
cidr_blocks = ["172.24.2.0/24"]
}
ingress {
description = "kubelet api"
from_port = 10250
to_port = 10250
protocol = "tcp"
cidr_blocks = ["172.24.2.0/24"]
}
ingress {
description = "Cilium Geneve or VXLAN"
from_port = 8472
to_port = 8472
protocol = "tcp"
cidr_blocks = ["172.24.2.0/24"]
}
ingress {
description = "Cilium Health Check"
from_port = 4240
to_port = 4240
protocol = "tcp"
cidr_blocks = ["172.24.2.0/24"]
}
ingress {
description = "api-server"
from_port = 6443
to_port = 6443
protocol = "tcp"
cidr_blocks = ["172.24.2.0/24"]
}
ingress {
description = "node port range"
from_port = 30000
to_port = 32767
protocol = "tcp"
cidr_blocks = ["172.24.2.0/24"]
}
ingress {
description = "Cilium Operator"
from_port = 2379
to_port = 2379
protocol = "tcp"
cidr_blocks = ["172.24.2.0/24"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
tags = {
Name = "dskdemo-allow-security"
}
}

View File

@@ -0,0 +1,470 @@
{
"version": 4,
"terraform_version": "1.4.6",
"serial": 8,
"lineage": "52e87bf7-135d-91e1-6212-adda0c0c1c37",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_ebs_volume",
"name": "dskdemo2_ebs",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:volume/vol-0d940e174d486470d",
"availability_zone": "ap-northeast-2c",
"encrypted": true,
"final_snapshot": false,
"id": "vol-0d940e174d486470d",
"iops": 300,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"multi_attach_enabled": false,
"outpost_arn": "",
"size": 100,
"snapshot_id": "",
"tags": {
"Name": "dskdemo2-ebs"
},
"tags_all": {
"Name": "dskdemo2-ebs"
},
"throughput": 0,
"timeouts": null,
"type": "gp2"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjMwMDAwMDAwMDAwMH19",
"dependencies": [
"aws_instance.dskdemo2",
"aws_security_group.dskdemo-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_ebs_volume",
"name": "dskdemo_ebs",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:volume/vol-0ac9975e51ec72682",
"availability_zone": "ap-northeast-2c",
"encrypted": true,
"final_snapshot": false,
"id": "vol-0ac9975e51ec72682",
"iops": 300,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"multi_attach_enabled": false,
"outpost_arn": "",
"size": 100,
"snapshot_id": "",
"tags": {
"Name": "dskdemo-ebs"
},
"tags_all": {
"Name": "dskdemo-ebs"
},
"throughput": 0,
"timeouts": null,
"type": "gp2"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjMwMDAwMDAwMDAwMH19",
"dependencies": [
"aws_instance.dskdemo",
"aws_security_group.dskdemo-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_instance",
"name": "dskdemo",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0c27244ec9d87b4e8",
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-052ddfaa3948d4ee3",
"associate_public_ip_address": false,
"availability_zone": "ap-northeast-2c",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_options": [
{
"amd_sev_snp": "",
"core_count": 1,
"threads_per_core": 2
}
],
"cpu_threads_per_core": 2,
"credit_specification": [
{
"cpu_credits": "unlimited"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-052ddfaa3948d4ee3",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
"instance_state": "running",
"instance_type": "t3.small",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kp-jay-bastion-datasaker",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "optional",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-0945c4acbc3bff8c1",
"private_dns": "i-052ddfaa3948d4ee3.ap-northeast-2.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": true,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "resource-name"
}
],
"private_ip": "172.24.2.121",
"public_dns": "",
"public_ip": "",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/xvda",
"encrypted": true,
"iops": 100,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"tags": null,
"throughput": 0,
"volume_id": "vol-013872983cfbbfa2a",
"volume_size": 30,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-0073a61bc56a68a3e",
"tags": {
"Name": "dskdemo"
},
"tags_all": {
"Name": "dskdemo"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-073c247730836f7fd"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"aws_security_group.dskdemo-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_instance",
"name": "dskdemo2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0c27244ec9d87b4e8",
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-0dad753d4392f5144",
"associate_public_ip_address": false,
"availability_zone": "ap-northeast-2c",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_options": [
{
"amd_sev_snp": "",
"core_count": 1,
"threads_per_core": 2
}
],
"cpu_threads_per_core": 2,
"credit_specification": [
{
"cpu_credits": "unlimited"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-0dad753d4392f5144",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
"instance_state": "running",
"instance_type": "t3.small",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kp-jay-bastion-datasaker",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "optional",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-0289f9f895e56ec92",
"private_dns": "i-0dad753d4392f5144.ap-northeast-2.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": true,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "resource-name"
}
],
"private_ip": "172.24.2.164",
"public_dns": "",
"public_ip": "",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/xvda",
"encrypted": true,
"iops": 100,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"tags": null,
"throughput": 0,
"volume_id": "vol-093b7f4eb73d57435",
"volume_size": 30,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-0073a61bc56a68a3e",
"tags": {
"Name": "dskdemo2"
},
"tags_all": {
"Name": "dskdemo2"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-073c247730836f7fd"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"aws_security_group.dskdemo-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "dskdemo-allow-security",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:security-group/sg-073c247730836f7fd",
"description": "Allow inbound traffic",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [
"::/0"
],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
}
],
"id": "sg-073c247730836f7fd",
"ingress": [
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "SSH",
"from_port": 22,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 22
}
],
"name": "dskdemo-allow-security-new",
"name_prefix": "",
"owner_id": "508259851457",
"revoke_rules_on_delete": false,
"tags": {
"Name": "dskdemo-allow-security"
},
"tags_all": {
"Name": "dskdemo-allow-security"
},
"timeouts": null,
"vpc_id": "vpc-00ba2b0e9ad59f0ed"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0="
}
]
},
{
"mode": "managed",
"type": "aws_volume_attachment",
"name": "dskdemo2_ebs_attach",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"device_name": "/dev/xvdf",
"force_detach": null,
"id": "vai-3450723728",
"instance_id": "i-0dad753d4392f5144",
"skip_destroy": null,
"stop_instance_before_detaching": null,
"timeouts": null,
"volume_id": "vol-0d940e174d486470d"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwfX0=",
"dependencies": [
"aws_ebs_volume.dskdemo2_ebs",
"aws_instance.dskdemo2",
"aws_security_group.dskdemo-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_volume_attachment",
"name": "dskdemo_ebs_attach",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"device_name": "/dev/xvdf",
"force_detach": null,
"id": "vai-210491461",
"instance_id": "i-052ddfaa3948d4ee3",
"skip_destroy": null,
"stop_instance_before_detaching": null,
"timeouts": null,
"volume_id": "vol-0ac9975e51ec72682"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwfX0=",
"dependencies": [
"aws_ebs_volume.dskdemo_ebs",
"aws_instance.dskdemo",
"aws_security_group.dskdemo-allow-security"
]
}
]
}
],
"check_results": null
}

View File

@@ -0,0 +1,39 @@
#---------------------------------------------------------------#
# Network ID
variable "VPC_ID" {
default = "vpc-00ba2b0e9ad59f0ed"
}
variable "Network_CIDR" {
default = "172.24.0.0/19"
}
variable "Private_Subnet_ID_1" {
default = "subnet-024f0deda82039fa4"
}
variable "Private_Subnet_ID_2" {
default = "subnet-050d942fa1c46540a"
}
variable "Private_Subnet_ID_3" {
default = "subnet-0946eb806af7377be"
}
variable "Public_Subnet_ID_1" {
default = "subnet-00c363356f133411d"
}
variable "Public_Subnet_ID_2" {
default = "subnet-07aa5e879a262014d"
}
variable "Public_Subnet_ID_3" {
default = "subnet-0073a61bc56a68a3e"
}
variable "datasaker-io" {
default = "Z072735718G25WNVKU834"
}

View File

@@ -0,0 +1,44 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/archive" {
version = "1.3.0"
constraints = "~> 1.3"
hashes = [
"h1:T3DszgOa/75SiiONgEDRujpN5rSqIw9TvFZXHjpqMB4=",
"zh:115aa6bc7825402a8d4e2e954378a9f48e4fdbeabe081ffd04e0a2f6786159bb",
"zh:21f731ffac20a67615c64a7a8a96949c971ee28ffd5807d8c299faba73b5e273",
"zh:2e81b58e141b175cbf801ade5e87c5db4cb28933216b0547ef32c95500385904",
"zh:3acbb96fd142b4d193dc18861340281249301368029169e346d15410d0572492",
"zh:4346edee0dfe97154b6f28d9ef0fa762131db92b78bbd1b3207945201cb59818",
"zh:93916a84cc6ff6778456dd170a657326c4dd3a86b4434e424a66a87c2535b888",
"zh:ade675c3ac8b9ec91131bac5881fbd4efad46a3683f2fea2efb9493a2c1b9ffb",
"zh:b0a0cb13fc850903aa7a057ae7e06366939b8f347926dce1137cd47b9123ad93",
"zh:d6d838cceffb7f3ff27fb9b51d78fccdef15bd32408f33a726556bfe66315bd3",
"zh:ddc4ac6aea6537f8096ffeb8ff3bca355f0972793184e0f6df120aa6460b4446",
"zh:e0d1213625d40d124bd9570f0d92907416f8d61bc8c389c776e72c0a97020cce",
"zh:eb707b69f9093b97d98e2dece9822852a27849dd1627d35302e8d6b9801407ef",
]
}
provider "registry.terraform.io/hashicorp/aws" {
version = "4.65.0"
hashes = [
"h1:fbSgoS5GLuwKAZlovFvGoYl4B0Bi5T7+MmFiVZL0uOo=",
"zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9",
"zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b",
"zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64",
"zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a",
"zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7",
"zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207",
"zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8",
"zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544",
"zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07",
"zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483",
"zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88",
"zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef",
"zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd",
]
}

View File

@@ -0,0 +1,41 @@
resource "aws_instance" "monitoring" {
ami = "ami-0409b7ddbc59e3222"
instance_type = "t3.small"
key_name = "kp-jay-bastion-datasaker"
vpc_security_group_ids = [aws_security_group.monitoring-allow-security.id]
availability_zone = "ap-northeast-2c"
subnet_id = var.Public_Subnet_ID_3
root_block_device {
delete_on_termination = true
volume_size = 30
}
tags = {
Name = "monitoring"
}
}
resource "aws_eip" "monitoring_eip" {
vpc = true
instance = aws_instance.monitoring.id
tags = {
Name = "monitoring-eip"
}
}
resource "aws_ebs_volume" "monitoring_ebs" {
availability_zone = aws_instance.monitoring.availability_zone
size = 100
tags = {
Name = "monitoring-ebs"
}
}
resource "aws_volume_attachment" "monitoring_ebs_attach" {
device_name = "/dev/xvdf"
volume_id = aws_ebs_volume.monitoring_ebs.id
instance_id = aws_instance.monitoring.id
}

View File

@@ -0,0 +1,10 @@
provider "aws" {
region = "ap-northeast-2"
}
terraform {
required_providers {
archive = "~> 1.3"
}
}

View File

@@ -0,0 +1,8 @@
resource "aws_route53_record" "monitoring" {
zone_id = "${var.datasaker-io}"
name = "monitoring.kr.datasaker.io"
type = "A"
ttl = "300"
records = [aws_eip.monitoring_eip.public_ip]
}

View File

@@ -0,0 +1,41 @@
resource "aws_security_group" "monitoring-allow-security" {
name = "monitoring-allow-security-new"
description = "Allow inbound traffic"
vpc_id = var.VPC_ID
ingress {
description = "SSH"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"]
}
ingress {
description = "TLS from monitoring"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"]
}
ingress {
description = "loki"
from_port = 31768
to_port = 31768
protocol = "tcp"
cidr_blocks = ["172.24.0.0/16"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
tags = {
Name = "monitoring-allow-security"
}
}

View File

@@ -0,0 +1,9 @@
{
"version": 4,
"terraform_version": "1.3.7",
"serial": 14,
"lineage": "b244d6e2-ddf9-06f1-7d1d-36ae5f9e2690",
"outputs": {},
"resources": [],
"check_results": null
}

View File

@@ -0,0 +1,370 @@
{
"version": 4,
"terraform_version": "1.3.7",
"serial": 7,
"lineage": "b244d6e2-ddf9-06f1-7d1d-36ae5f9e2690",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_ebs_volume",
"name": "monitoring_ebs",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:volume/vol-0a6f71b76b33ec00b",
"availability_zone": "ap-northeast-2c",
"encrypted": false,
"final_snapshot": false,
"id": "vol-0a6f71b76b33ec00b",
"iops": 300,
"kms_key_id": "",
"multi_attach_enabled": false,
"outpost_arn": "",
"size": 100,
"snapshot_id": "",
"tags": {
"Name": "monitoring-ebs"
},
"tags_all": {
"Name": "monitoring-ebs"
},
"throughput": 0,
"timeouts": null,
"type": "gp2"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjMwMDAwMDAwMDAwMH19",
"dependencies": [
"aws_instance.monitoring",
"aws_security_group.monitoring-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_eip",
"name": "monitoring_eip",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"address": null,
"allocation_id": "eipalloc-09ba2d1ff002bc87b",
"associate_with_private_ip": null,
"association_id": "eipassoc-0f07cba160cf921d4",
"carrier_ip": "",
"customer_owned_ip": "",
"customer_owned_ipv4_pool": "",
"domain": "vpc",
"id": "eipalloc-09ba2d1ff002bc87b",
"instance": "i-084d54369608ba75d",
"network_border_group": "ap-northeast-2",
"network_interface": "eni-047d040d1d5152d9e",
"private_dns": "ip-172-24-2-44.ap-northeast-2.compute.internal",
"private_ip": "172.24.2.44",
"public_dns": "ec2-15-164-91-52.ap-northeast-2.compute.amazonaws.com",
"public_ip": "15.164.91.52",
"public_ipv4_pool": "amazon",
"tags": {
"Name": "monitoring-eip"
},
"tags_all": {
"Name": "monitoring-eip"
},
"timeouts": null,
"vpc": true
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==",
"dependencies": [
"aws_instance.monitoring",
"aws_security_group.monitoring-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_instance",
"name": "monitoring",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0409b7ddbc59e3222",
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-084d54369608ba75d",
"associate_public_ip_address": false,
"availability_zone": "ap-northeast-2c",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_threads_per_core": 2,
"credit_specification": [
{
"cpu_credits": "unlimited"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-084d54369608ba75d",
"instance_initiated_shutdown_behavior": "stop",
"instance_state": "running",
"instance_type": "t3.small",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kp-jay-bastion-datasaker",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "optional",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-047d040d1d5152d9e",
"private_dns": "i-084d54369608ba75d.ap-northeast-2.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": true,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "resource-name"
}
],
"private_ip": "172.24.2.44",
"public_dns": "",
"public_ip": "",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/sda1",
"encrypted": false,
"iops": 100,
"kms_key_id": "",
"tags": null,
"throughput": 0,
"volume_id": "vol-0e2628f12cc09f442",
"volume_size": 30,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"subnet_id": "subnet-0073a61bc56a68a3e",
"tags": {
"Name": "monitoring"
},
"tags_all": {
"Name": "monitoring"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-0cdf2dd6e68b0c3fe"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"aws_security_group.monitoring-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_route53_record",
"name": "monitoring",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 2,
"attributes": {
"alias": [],
"allow_overwrite": null,
"cidr_routing_policy": [],
"failover_routing_policy": [],
"fqdn": "testmonitoring.kr.datasaker.io",
"geolocation_routing_policy": [],
"health_check_id": "",
"id": "Z072735718G25WNVKU834_testmonitoring.kr.datasaker.io_A",
"latency_routing_policy": [],
"multivalue_answer_routing_policy": false,
"name": "testmonitoring.kr.datasaker.io",
"records": [
"15.164.91.52"
],
"set_identifier": "",
"ttl": 300,
"type": "A",
"weighted_routing_policy": [],
"zone_id": "Z072735718G25WNVKU834"
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjIifQ==",
"dependencies": [
"aws_eip.monitoring_eip",
"aws_instance.monitoring",
"aws_security_group.monitoring-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "monitoring-allow-security",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:security-group/sg-0cdf2dd6e68b0c3fe",
"description": "Allow inbound traffic",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [
"::/0"
],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
}
],
"id": "sg-0cdf2dd6e68b0c3fe",
"ingress": [
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "SSH",
"from_port": 22,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 22
},
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "TLS from monitoring",
"from_port": 443,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 443
},
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "http fron monitoring",
"from_port": 80,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 80
}
],
"name": "monitoring-allow-security-new",
"name_prefix": "",
"owner_id": "508259851457",
"revoke_rules_on_delete": false,
"tags": {
"Name": "monitoring-allow-security"
},
"tags_all": {
"Name": "monitoring-allow-security"
},
"timeouts": null,
"vpc_id": "vpc-00ba2b0e9ad59f0ed"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0="
}
]
},
{
"mode": "managed",
"type": "aws_volume_attachment",
"name": "monitoring_ebs_attach",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"device_name": "/dev/xvdf",
"force_detach": null,
"id": "vai-652215165",
"instance_id": "i-084d54369608ba75d",
"skip_destroy": null,
"stop_instance_before_detaching": null,
"timeouts": null,
"volume_id": "vol-0a6f71b76b33ec00b"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwfX0=",
"dependencies": [
"aws_ebs_volume.monitoring_ebs",
"aws_instance.monitoring",
"aws_security_group.monitoring-allow-security"
]
}
]
}
],
"check_results": null
}

View File

@@ -0,0 +1,39 @@
#---------------------------------------------------------------#
# Network ID
variable "VPC_ID" {
default = "vpc-00ba2b0e9ad59f0ed"
}
variable "Network_CIDR" {
default = "172.24.0.0/19"
}
variable "Private_Subnet_ID_1" {
default = "subnet-024f0deda82039fa4"
}
variable "Private_Subnet_ID_2" {
default = "subnet-050d942fa1c46540a"
}
variable "Private_Subnet_ID_3" {
default = "subnet-0946eb806af7377be"
}
variable "Public_Subnet_ID_1" {
default = "subnet-00c363356f133411d"
}
variable "Public_Subnet_ID_2" {
default = "subnet-07aa5e879a262014d"
}
variable "Public_Subnet_ID_3" {
default = "subnet-0073a61bc56a68a3e"
}
variable "datasaker-io" {
default = "Z072735718G25WNVKU834"
}

View File

@@ -0,0 +1,44 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/archive" {
version = "1.3.0"
constraints = "~> 1.3"
hashes = [
"h1:T3DszgOa/75SiiONgEDRujpN5rSqIw9TvFZXHjpqMB4=",
"zh:115aa6bc7825402a8d4e2e954378a9f48e4fdbeabe081ffd04e0a2f6786159bb",
"zh:21f731ffac20a67615c64a7a8a96949c971ee28ffd5807d8c299faba73b5e273",
"zh:2e81b58e141b175cbf801ade5e87c5db4cb28933216b0547ef32c95500385904",
"zh:3acbb96fd142b4d193dc18861340281249301368029169e346d15410d0572492",
"zh:4346edee0dfe97154b6f28d9ef0fa762131db92b78bbd1b3207945201cb59818",
"zh:93916a84cc6ff6778456dd170a657326c4dd3a86b4434e424a66a87c2535b888",
"zh:ade675c3ac8b9ec91131bac5881fbd4efad46a3683f2fea2efb9493a2c1b9ffb",
"zh:b0a0cb13fc850903aa7a057ae7e06366939b8f347926dce1137cd47b9123ad93",
"zh:d6d838cceffb7f3ff27fb9b51d78fccdef15bd32408f33a726556bfe66315bd3",
"zh:ddc4ac6aea6537f8096ffeb8ff3bca355f0972793184e0f6df120aa6460b4446",
"zh:e0d1213625d40d124bd9570f0d92907416f8d61bc8c389c776e72c0a97020cce",
"zh:eb707b69f9093b97d98e2dece9822852a27849dd1627d35302e8d6b9801407ef",
]
}
provider "registry.terraform.io/hashicorp/aws" {
version = "4.52.0"
hashes = [
"h1:Ofm8syFCBU8MFOiU+zg+vnTWkSdozpmvaA9xukNvcBg=",
"zh:00c865de3a0e7643f4e2e5c8d4ba91eee94a46d41090eb134baca6b58c107172",
"zh:1430682e26eba25d8ace19fa780361187f474153e455545235b4fe30637fdcc2",
"zh:1b9a4e5c889bd2022bd59fb924dc78e189f1b7a4fd718fcacda0f0a4cb74d6eb",
"zh:2485260141608f1d386d0f68934092bbf68a27d96f0d83c73222d0382aee02f5",
"zh:2fe67ee94e2df7dabee7e474356f8e907e7c8011533f9d71df8702d59f9060b2",
"zh:37babd1b7ff96ff1f42aa56d7575cacabda6f9f460ff651d70662bfd90076341",
"zh:54aa8d39f22ecab6613169f49d37d2ccfaf417e59dd7a8c8fc6bf92600c3384f",
"zh:5bf4a84b962a8d2da8f4ccf2a7de56fb6c7a1f566e8393b563977fc7872a8740",
"zh:8cb4a51f209a3cc497e53f09188c15c6675697587fe2ea14a6c7fff10c8c8476",
"zh:91f6bdcbb1e36471140982e9048b7ced437d3290b2cc21079e5429cc84fed2fd",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:9f8c01c3f677bc64ddefa41e59c6fc98860c11875d7f148af55969d3e3847f77",
"zh:b6b4fc0bd6f3c0adcd9531da3ccf8c25787ccd6ccc568f13ebbff1336d71a9e1",
"zh:d52a428bd92cc319088685ecac63b9f7d12d4cd6725604edb20d0c4f37a9936e",
"zh:e20252a851a0d38548a3c01a006bfc59ee1fc84217bf9eb95b22724769601b2b",
]
}

View File

@@ -0,0 +1,60 @@
resource "aws_security_group" "grafana-allow-security" {
name = "grafana-allow-security"
description = "Allow inbound traffic"
vpc_id = var.VPC_ID
ingress {
description = "SSH"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"]
}
ingress {
description = "TLS from grafana"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"]
}
ingress {
description = "http fron grafana"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
tags = {
Name = "grafana-allow-security"
}
}
resource "aws_instance" "grafana" {
ami = "ami-0409b7ddbc59e3222"
instance_type = "t3.small"
key_name = "kp-jay-bastion-datasaker"
vpc_security_group_ids = [aws_security_group.grafana-allow-security.id]
availability_zone = "ap-northeast-2a"
subnet_id = var.Public_Subnet_ID_1
root_block_device {
delete_on_termination = true
volume_size = 30
}
tags = {
Name = "grafana"
}
}

View File

@@ -0,0 +1,10 @@
provider "aws" {
region = "ap-northeast-2"
}
terraform {
required_providers {
archive = "~> 1.3"
}
}

View File

@@ -0,0 +1,220 @@
{
"version": 4,
"terraform_version": "1.3.1",
"serial": 3,
"lineage": "946bb105-337f-c3fc-6b8b-e09f72b8b293",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_instance",
"name": "grafana",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0409b7ddbc59e3222",
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-09c4bc87fd369504e",
"associate_public_ip_address": false,
"availability_zone": "ap-northeast-2a",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_threads_per_core": 2,
"credit_specification": [
{
"cpu_credits": "unlimited"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-09c4bc87fd369504e",
"instance_initiated_shutdown_behavior": "stop",
"instance_state": "running",
"instance_type": "t3.small",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kp-jay-bastion-datasaker",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "optional",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-0b48b92d69735da43",
"private_dns": "i-09c4bc87fd369504e.ap-northeast-2.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": true,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "resource-name"
}
],
"private_ip": "172.24.0.88",
"public_dns": "",
"public_ip": "",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/sda1",
"encrypted": false,
"iops": 100,
"kms_key_id": "",
"tags": null,
"throughput": 0,
"volume_id": "vol-0f45b5aae9c328a33",
"volume_size": 30,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"subnet_id": "subnet-00c363356f133411d",
"tags": {
"Name": "grafana"
},
"tags_all": {
"Name": "grafana"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-014638e423c769405"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"aws_security_group.grafana-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "grafana-allow-security",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:security-group/sg-014638e423c769405",
"description": "Allow inbound traffic",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [
"::/0"
],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
}
],
"id": "sg-014638e423c769405",
"ingress": [
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "SSH",
"from_port": 22,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 22
},
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "TLS from grafana",
"from_port": 443,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 443
},
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "http fron grafana",
"from_port": 80,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 80
}
],
"name": "grafana-allow-security",
"name_prefix": "",
"owner_id": "508259851457",
"revoke_rules_on_delete": false,
"tags": {
"Name": "grafana-allow-security"
},
"tags_all": {
"Name": "grafana-allow-security"
},
"timeouts": null,
"vpc_id": "vpc-00ba2b0e9ad59f0ed"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0="
}
]
}
],
"check_results": []
}

View File

@@ -0,0 +1,35 @@
#---------------------------------------------------------------#
# Network ID
variable "VPC_ID" {
default = "vpc-00ba2b0e9ad59f0ed"
}
variable "Network_CIDR" {
default = "172.24.0.0/19"
}
variable "Private_Subnet_ID_1" {
default = "subnet-024f0deda82039fa4"
}
variable "Private_Subnet_ID_2" {
default = "subnet-050d942fa1c46540a"
}
variable "Private_Subnet_ID_3" {
default = "subnet-0946eb806af7377be"
}
variable "Public_Subnet_ID_1" {
default = "subnet-00c363356f133411d"
}
variable "Public_Subnet_ID_2" {
default = "subnet-07aa5e879a262014d"
}
variable "Public_Subnet_ID_3" {
default = "subnet-0073a61bc56a68a3e"
}

View File

@@ -0,0 +1,44 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/archive" {
version = "1.3.0"
constraints = "~> 1.3"
hashes = [
"h1:T3DszgOa/75SiiONgEDRujpN5rSqIw9TvFZXHjpqMB4=",
"zh:115aa6bc7825402a8d4e2e954378a9f48e4fdbeabe081ffd04e0a2f6786159bb",
"zh:21f731ffac20a67615c64a7a8a96949c971ee28ffd5807d8c299faba73b5e273",
"zh:2e81b58e141b175cbf801ade5e87c5db4cb28933216b0547ef32c95500385904",
"zh:3acbb96fd142b4d193dc18861340281249301368029169e346d15410d0572492",
"zh:4346edee0dfe97154b6f28d9ef0fa762131db92b78bbd1b3207945201cb59818",
"zh:93916a84cc6ff6778456dd170a657326c4dd3a86b4434e424a66a87c2535b888",
"zh:ade675c3ac8b9ec91131bac5881fbd4efad46a3683f2fea2efb9493a2c1b9ffb",
"zh:b0a0cb13fc850903aa7a057ae7e06366939b8f347926dce1137cd47b9123ad93",
"zh:d6d838cceffb7f3ff27fb9b51d78fccdef15bd32408f33a726556bfe66315bd3",
"zh:ddc4ac6aea6537f8096ffeb8ff3bca355f0972793184e0f6df120aa6460b4446",
"zh:e0d1213625d40d124bd9570f0d92907416f8d61bc8c389c776e72c0a97020cce",
"zh:eb707b69f9093b97d98e2dece9822852a27849dd1627d35302e8d6b9801407ef",
]
}
provider "registry.terraform.io/hashicorp/aws" {
version = "4.65.0"
hashes = [
"h1:fbSgoS5GLuwKAZlovFvGoYl4B0Bi5T7+MmFiVZL0uOo=",
"zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9",
"zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b",
"zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64",
"zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a",
"zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7",
"zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207",
"zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8",
"zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544",
"zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07",
"zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483",
"zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88",
"zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef",
"zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd",
]
}

View File

@@ -0,0 +1,109 @@
resource "aws_security_group" "grafana-allow-security" {
name = "grafana-allow-security-new"
description = "Allow inbound traffic"
vpc_id = var.VPC_ID
ingress {
description = "Allow SSH traffic"
from_port = 2222
to_port = 2222
protocol = "tcp"
cidr_blocks = ["39.115.183.236/32"]
}
# ingress {
# description = "Allow HTTP traffic"
# from_port = 80
# to_port = 80
# protocol = "tcp"
# cidr_blocks = ["118.223.123.161/32"]
# }
ingress {
description = "Allow HTTPS traffic"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32", "39.115.183.138/32", "39.115.183.236/32"]
}
# ingress {
# description = ""
# from_port = 443
# to_port = 443
# protocol = "tcp"
# cidr_blocks = ["0.0.0.0/0"]
# }
# ingress {
# description = "TLS from teleport"
# from_port = 30168
# to_port = 30168
# protocol = "tcp"
# cidr_blocks = ["0.0.0.0/0"]
# }
# ingress {
# description = ""
# from_port = 32084
# to_port = 32084
# protocol = "tcp"
# cidr_blocks = ["172.0.0.0/8"]
# }
# ingress {
# description = "loki"
# from_port = 31768
# to_port = 31768
# protocol = "tcp"
# cidr_blocks = ["172.24.0.0/16"]
# }
ingress {
description = ""
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["172.31.0.0/16"]
}
ingress {
description = "nlb-securitygroup"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = []
security_groups = ["sg-0c46bbbbc5ecc2786"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
tags = {
Name = "monitoring-allow-security"
}
}
resource "aws_instance" "grafana" {
ami = "ami-0409b7ddbc59e3222"
instance_type = "m5.large"
key_name = "kp-jay-bastion-datasaker"
vpc_security_group_ids = [aws_security_group.grafana-allow-security.id]
availability_zone = "ap-northeast-2c"
subnet_id = var.Public_Subnet_ID_3
root_block_device {
delete_on_termination = true
volume_size = 30
}
tags = {
Name = "monitoring.kr.datasaker.io"
}
}

View File

@@ -0,0 +1,10 @@
provider "aws" {
region = "ap-northeast-2"
}
terraform {
required_providers {
archive = "~> 1.3"
}
}

View File

@@ -0,0 +1,249 @@
{
"version": 4,
"terraform_version": "1.5.7",
"serial": 22,
"lineage": "816258a5-69eb-6967-f105-8709f7e2588d",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_instance",
"name": "grafana",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0409b7ddbc59e3222",
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-08af287265bd05022",
"associate_public_ip_address": true,
"availability_zone": "ap-northeast-2c",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_threads_per_core": 2,
"credit_specification": [
{
"cpu_credits": "unlimited"
}
],
"disable_api_stop": false,
"disable_api_termination": true,
"ebs_block_device": [
{
"delete_on_termination": false,
"device_name": "/dev/sdf",
"encrypted": false,
"iops": 600,
"kms_key_id": "",
"snapshot_id": "",
"tags": {},
"throughput": 0,
"volume_id": "vol-0a2e83f6a2d3d12b3",
"volume_size": 200,
"volume_type": "gp2"
}
],
"ebs_optimized": true,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "AmazonSSMRoleForInstancesQuickSetup",
"id": "i-08af287265bd05022",
"instance_initiated_shutdown_behavior": "stop",
"instance_state": "running",
"instance_type": "m5.large",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kp-jay-bastion-datasaker",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "required",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-073cf0ad9107c09ab",
"private_dns": "i-08af287265bd05022.ap-northeast-2.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": true,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "resource-name"
}
],
"private_ip": "172.24.2.212",
"public_dns": "ec2-3-38-1-96.ap-northeast-2.compute.amazonaws.com",
"public_ip": "3.38.1.96",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/sda1",
"encrypted": false,
"iops": 100,
"kms_key_id": "",
"tags": {},
"throughput": 0,
"volume_id": "vol-0153e1bed3b29f8b2",
"volume_size": 30,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"subnet_id": "subnet-0073a61bc56a68a3e",
"tags": {
"Name": "monitoring.kr.datasaker.io"
},
"tags_all": {
"Name": "monitoring.kr.datasaker.io"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-0aa579ce45269425a"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"aws_security_group.grafana-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "grafana-allow-security",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:security-group/sg-0aa579ce45269425a",
"description": "Allow inbound traffic",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [
"::/0"
],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
}
],
"id": "sg-0aa579ce45269425a",
"ingress": [
{
"cidr_blocks": [
"118.223.123.161/32",
"39.115.183.138/32",
"39.115.183.236/32"
],
"description": "Allow HTTPS traffic",
"from_port": 443,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 443
},
{
"cidr_blocks": [
"172.31.0.0/16"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
},
{
"cidr_blocks": [
"39.115.183.236/32"
],
"description": "Allow SSH traffic",
"from_port": 2222,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 2222
},
{
"cidr_blocks": [],
"description": "nlb-securitygroup",
"from_port": 0,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [
"sg-0c46bbbbc5ecc2786"
],
"self": false,
"to_port": 0
}
],
"name": "grafana-allow-security-new",
"name_prefix": "",
"owner_id": "508259851457",
"revoke_rules_on_delete": false,
"tags": {
"Name": "monitoring-allow-security"
},
"tags_all": {
"Name": "monitoring-allow-security"
},
"timeouts": null,
"vpc_id": "vpc-00ba2b0e9ad59f0ed"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0="
}
]
}
],
"check_results": null
}

View File

@@ -0,0 +1,249 @@
{
"version": 4,
"terraform_version": "1.5.7",
"serial": 20,
"lineage": "816258a5-69eb-6967-f105-8709f7e2588d",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_instance",
"name": "grafana",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0409b7ddbc59e3222",
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-08af287265bd05022",
"associate_public_ip_address": true,
"availability_zone": "ap-northeast-2c",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_threads_per_core": 2,
"credit_specification": [
{
"cpu_credits": "unlimited"
}
],
"disable_api_stop": false,
"disable_api_termination": true,
"ebs_block_device": [
{
"delete_on_termination": false,
"device_name": "/dev/sdf",
"encrypted": false,
"iops": 600,
"kms_key_id": "",
"snapshot_id": "",
"tags": {},
"throughput": 0,
"volume_id": "vol-0a2e83f6a2d3d12b3",
"volume_size": 200,
"volume_type": "gp2"
}
],
"ebs_optimized": true,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "AmazonSSMRoleForInstancesQuickSetup",
"id": "i-08af287265bd05022",
"instance_initiated_shutdown_behavior": "stop",
"instance_state": "running",
"instance_type": "m5.large",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kp-jay-bastion-datasaker",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "required",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-073cf0ad9107c09ab",
"private_dns": "i-08af287265bd05022.ap-northeast-2.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": true,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "resource-name"
}
],
"private_ip": "172.24.2.212",
"public_dns": "ec2-3-38-1-96.ap-northeast-2.compute.amazonaws.com",
"public_ip": "3.38.1.96",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/sda1",
"encrypted": false,
"iops": 100,
"kms_key_id": "",
"tags": {},
"throughput": 0,
"volume_id": "vol-0153e1bed3b29f8b2",
"volume_size": 30,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"subnet_id": "subnet-0073a61bc56a68a3e",
"tags": {
"Name": "monitoring.kr.datasaker.io"
},
"tags_all": {
"Name": "monitoring.kr.datasaker.io"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-0aa579ce45269425a"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"aws_security_group.grafana-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "grafana-allow-security",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:security-group/sg-0aa579ce45269425a",
"description": "Allow inbound traffic",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [
"::/0"
],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
}
],
"id": "sg-0aa579ce45269425a",
"ingress": [
{
"cidr_blocks": [
"118.223.123.161/32",
"39.115.183.138/32",
"39.115.183.236/32"
],
"description": "Allow HTTPS traffic",
"from_port": 443,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 443
},
{
"cidr_blocks": [
"172.31.0.0/16"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
},
{
"cidr_blocks": [
"39.115.183.236/32"
],
"description": "Allow SSH traffic",
"from_port": 22,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 22
},
{
"cidr_blocks": [],
"description": "nlb-securitygroup",
"from_port": 0,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [
"sg-0c46bbbbc5ecc2786"
],
"self": false,
"to_port": 0
}
],
"name": "grafana-allow-security-new",
"name_prefix": "",
"owner_id": "508259851457",
"revoke_rules_on_delete": false,
"tags": {
"Name": "monitoring-allow-security"
},
"tags_all": {
"Name": "monitoring-allow-security"
},
"timeouts": null,
"vpc_id": "vpc-00ba2b0e9ad59f0ed"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0="
}
]
}
],
"check_results": null
}

View File

@@ -0,0 +1,35 @@
#---------------------------------------------------------------#
# Network ID
variable "VPC_ID" {
default = "vpc-00ba2b0e9ad59f0ed"
}
variable "Network_CIDR" {
default = "172.24.0.0/19"
}
variable "Private_Subnet_ID_1" {
default = "subnet-024f0deda82039fa4"
}
variable "Private_Subnet_ID_2" {
default = "subnet-050d942fa1c46540a"
}
variable "Private_Subnet_ID_3" {
default = "subnet-0946eb806af7377be"
}
variable "Public_Subnet_ID_1" {
default = "subnet-00c363356f133411d"
}
variable "Public_Subnet_ID_2" {
default = "subnet-07aa5e879a262014d"
}
variable "Public_Subnet_ID_3" {
default = "subnet-0073a61bc56a68a3e"
}

View File

@@ -0,0 +1,44 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/archive" {
version = "1.3.0"
constraints = "~> 1.3"
hashes = [
"h1:T3DszgOa/75SiiONgEDRujpN5rSqIw9TvFZXHjpqMB4=",
"zh:115aa6bc7825402a8d4e2e954378a9f48e4fdbeabe081ffd04e0a2f6786159bb",
"zh:21f731ffac20a67615c64a7a8a96949c971ee28ffd5807d8c299faba73b5e273",
"zh:2e81b58e141b175cbf801ade5e87c5db4cb28933216b0547ef32c95500385904",
"zh:3acbb96fd142b4d193dc18861340281249301368029169e346d15410d0572492",
"zh:4346edee0dfe97154b6f28d9ef0fa762131db92b78bbd1b3207945201cb59818",
"zh:93916a84cc6ff6778456dd170a657326c4dd3a86b4434e424a66a87c2535b888",
"zh:ade675c3ac8b9ec91131bac5881fbd4efad46a3683f2fea2efb9493a2c1b9ffb",
"zh:b0a0cb13fc850903aa7a057ae7e06366939b8f347926dce1137cd47b9123ad93",
"zh:d6d838cceffb7f3ff27fb9b51d78fccdef15bd32408f33a726556bfe66315bd3",
"zh:ddc4ac6aea6537f8096ffeb8ff3bca355f0972793184e0f6df120aa6460b4446",
"zh:e0d1213625d40d124bd9570f0d92907416f8d61bc8c389c776e72c0a97020cce",
"zh:eb707b69f9093b97d98e2dece9822852a27849dd1627d35302e8d6b9801407ef",
]
}
provider "registry.terraform.io/hashicorp/aws" {
version = "4.65.0"
hashes = [
"h1:fbSgoS5GLuwKAZlovFvGoYl4B0Bi5T7+MmFiVZL0uOo=",
"zh:0461b8dfc14e94971bfd12783cbd5a5574b9fcfc3694b6afaa8836f90b61c1f9",
"zh:24a27e7b1f6eb33e9da6f2ffaaa6bc48e933a24224c6572d6e588994e5c7130b",
"zh:2ca189d04573414bef4876c17ccb2b76f6e721e0450f6ab3700d94d7c04bec64",
"zh:3fb0654a527677231dab2140e9a55df3b90dba478b3db50001e21a045437a47a",
"zh:4918173d9c7d2735908622c17efd01746a046f0a571690afa7dd0866f22045f7",
"zh:491d259b15166f751076d2bdc443928ca63f6c0a83b02ea75fff8b4224662207",
"zh:4ff8e178f0656f04f88558c295a1d246b1bdcf5ad81d8b3b9ccceaeca2eb7fa8",
"zh:5e4eaf2855a740124f4bbe34ac4bd22c7f320aa3e91d9cef64396ad0a1571544",
"zh:65762c60c4bac2e0d55ed8c2877e455e84465cb12f0c885363a1b561cd4f5f07",
"zh:7c5e4f85eb5f70e6da2d64701dd5551f2bc334dbb9add76bfc6a2bea6acf4483",
"zh:90d32b238113528319d7a5fade97bd8ac9a8b654482fc9056478a43d2e297886",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:e6ed3299516a8fb2292af7e7e123d09817dfd8e039aaf35ad5a276f739668e88",
"zh:eb84fa96c63d836b3b4689835cb7c4487808dfd1ba7ddacf4d8c4c6ff65cdbef",
"zh:ff97d1498193c99c9c35afd9bfcdce011abf460ec041721727d6e542f7a3bedd",
]
}

View File

@@ -0,0 +1,41 @@
resource "aws_instance" "superset" {
ami = "ami-0409b7ddbc59e3222"
instance_type = "t3.small"
key_name = "kp-jay-bastion-datasaker"
vpc_security_group_ids = [aws_security_group.superset-allow-security.id]
availability_zone = "ap-northeast-2c"
subnet_id = var.Public_Subnet_ID_3
root_block_device {
delete_on_termination = true
volume_size = 30
}
tags = {
Name = "superset"
}
}
resource "aws_eip" "superset_eip" {
vpc = true
instance = aws_instance.superset.id
tags = {
Name = "superset-eip"
}
}
resource "aws_ebs_volume" "superset_ebs" {
availability_zone = aws_instance.superset.availability_zone
size = 100
tags = {
Name = "superset-ebs"
}
}
resource "aws_volume_attachment" "superset_ebs_attach" {
device_name = "/dev/xvdf"
volume_id = aws_ebs_volume.superset_ebs.id
instance_id = aws_instance.superset.id
}

View File

@@ -0,0 +1,10 @@
provider "aws" {
region = "ap-northeast-2"
}
terraform {
required_providers {
archive = "~> 1.3"
}
}

View File

@@ -0,0 +1,7 @@
resource "aws_route53_record" "superset" {
zone_id = "${var.datasaker-io}"
name = "superset.kr.datasaker.io"
type = "A"
ttl = "300"
records = [aws_eip.superset_eip.public_ip]
}

View File

@@ -0,0 +1,33 @@
resource "aws_security_group" "superset-allow-security" {
name = "superset-allow-security-new"
description = "Allow inbound traffic"
vpc_id = var.VPC_ID
ingress {
description = "SSH"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"]
}
ingress {
description = "TLS from superset"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
tags = {
Name = "superset-allow-security"
}
}

View File

@@ -0,0 +1,371 @@
{
"version": 4,
"terraform_version": "1.4.6",
"serial": 32,
"lineage": "b244d6e2-ddf9-06f1-7d1d-36ae5f9e2690",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_ebs_volume",
"name": "superset_ebs",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:volume/vol-00d7bfddea039e2a3",
"availability_zone": "ap-northeast-2c",
"encrypted": true,
"final_snapshot": false,
"id": "vol-00d7bfddea039e2a3",
"iops": 300,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"multi_attach_enabled": false,
"outpost_arn": "",
"size": 100,
"snapshot_id": "",
"tags": {
"Name": "superset-ebs"
},
"tags_all": {
"Name": "superset-ebs"
},
"throughput": 0,
"timeouts": null,
"type": "gp2"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjMwMDAwMDAwMDAwMH19",
"dependencies": [
"aws_instance.superset",
"aws_security_group.superset-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_eip",
"name": "superset_eip",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"address": null,
"allocation_id": "eipalloc-0bc6f0725907c2b97",
"associate_with_private_ip": null,
"association_id": "eipassoc-0e6bfb4ec0f8dc921",
"carrier_ip": "",
"customer_owned_ip": "",
"customer_owned_ipv4_pool": "",
"domain": "vpc",
"id": "eipalloc-0bc6f0725907c2b97",
"instance": "i-08b854173a9f65959",
"network_border_group": "ap-northeast-2",
"network_interface": "eni-03306af4a9f039398",
"private_dns": "ip-172-24-2-139.ap-northeast-2.compute.internal",
"private_ip": "172.24.2.139",
"public_dns": "ec2-43-200-67-243.ap-northeast-2.compute.amazonaws.com",
"public_ip": "43.200.67.243",
"public_ipv4_pool": "amazon",
"tags": {
"Name": "superset-eip"
},
"tags_all": {
"Name": "superset-eip"
},
"timeouts": null,
"vpc": true
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==",
"dependencies": [
"aws_instance.superset",
"aws_security_group.superset-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_instance",
"name": "superset",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0409b7ddbc59e3222",
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-08b854173a9f65959",
"associate_public_ip_address": true,
"availability_zone": "ap-northeast-2c",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_threads_per_core": 2,
"credit_specification": [
{
"cpu_credits": "unlimited"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [
{
"delete_on_termination": false,
"device_name": "/dev/xvdf",
"encrypted": true,
"iops": 300,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"snapshot_id": "",
"tags": {
"Name": "superset-ebs"
},
"throughput": 0,
"volume_id": "vol-00d7bfddea039e2a3",
"volume_size": 100,
"volume_type": "gp2"
}
],
"ebs_optimized": false,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-08b854173a9f65959",
"instance_initiated_shutdown_behavior": "stop",
"instance_state": "running",
"instance_type": "t3.small",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kp-jay-bastion-datasaker",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "optional",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-03306af4a9f039398",
"private_dns": "i-08b854173a9f65959.ap-northeast-2.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": true,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "resource-name"
}
],
"private_ip": "172.24.2.139",
"public_dns": "ec2-43-200-67-243.ap-northeast-2.compute.amazonaws.com",
"public_ip": "43.200.67.243",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/sda1",
"encrypted": true,
"iops": 100,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"tags": {},
"throughput": 0,
"volume_id": "vol-00b406bbc857781e8",
"volume_size": 30,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"subnet_id": "subnet-0073a61bc56a68a3e",
"tags": {
"Name": "superset"
},
"tags_all": {
"Name": "superset"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-0a90049d737c4847c"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"aws_security_group.superset-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_route53_record",
"name": "superset",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 2,
"attributes": {
"alias": [],
"allow_overwrite": null,
"cidr_routing_policy": [],
"failover_routing_policy": [],
"fqdn": "superset.kr.datasaker.io",
"geolocation_routing_policy": [],
"health_check_id": "",
"id": "Z072735718G25WNVKU834_superset.kr.datasaker.io_A",
"latency_routing_policy": [],
"multivalue_answer_routing_policy": false,
"name": "superset.kr.datasaker.io",
"records": [
"43.200.67.243"
],
"set_identifier": "",
"ttl": 300,
"type": "A",
"weighted_routing_policy": [],
"zone_id": "Z072735718G25WNVKU834"
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjIifQ==",
"dependencies": [
"aws_eip.superset_eip"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "superset-allow-security",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:security-group/sg-0a90049d737c4847c",
"description": "Allow inbound traffic",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [
"::/0"
],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
}
],
"id": "sg-0a90049d737c4847c",
"ingress": [
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "SSH",
"from_port": 22,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 22
},
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "TLS from superset",
"from_port": 443,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 443
}
],
"name": "superset-allow-security-new",
"name_prefix": "",
"owner_id": "508259851457",
"revoke_rules_on_delete": false,
"tags": {
"Name": "superset-allow-security"
},
"tags_all": {
"Name": "superset-allow-security"
},
"timeouts": null,
"vpc_id": "vpc-00ba2b0e9ad59f0ed"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0="
}
]
},
{
"mode": "managed",
"type": "aws_volume_attachment",
"name": "superset_ebs_attach",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"device_name": "/dev/xvdf",
"force_detach": null,
"id": "vai-1800967242",
"instance_id": "i-08b854173a9f65959",
"skip_destroy": null,
"stop_instance_before_detaching": null,
"timeouts": null,
"volume_id": "vol-00d7bfddea039e2a3"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwfX0=",
"dependencies": [
"aws_ebs_volume.superset_ebs",
"aws_instance.superset",
"aws_security_group.superset-allow-security"
]
}
]
}
],
"check_results": null
}

View File

@@ -0,0 +1,371 @@
{
"version": 4,
"terraform_version": "1.4.6",
"serial": 28,
"lineage": "b244d6e2-ddf9-06f1-7d1d-36ae5f9e2690",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_ebs_volume",
"name": "superset_ebs",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:volume/vol-00d7bfddea039e2a3",
"availability_zone": "ap-northeast-2c",
"encrypted": true,
"final_snapshot": false,
"id": "vol-00d7bfddea039e2a3",
"iops": 300,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"multi_attach_enabled": false,
"outpost_arn": "",
"size": 100,
"snapshot_id": "",
"tags": {
"Name": "superset-ebs"
},
"tags_all": {
"Name": "superset-ebs"
},
"throughput": 0,
"timeouts": null,
"type": "gp2"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjMwMDAwMDAwMDAwMH19",
"dependencies": [
"aws_instance.superset",
"aws_security_group.superset-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_eip",
"name": "superset_eip",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"address": null,
"allocation_id": "eipalloc-0bc6f0725907c2b97",
"associate_with_private_ip": null,
"association_id": "eipassoc-0e6bfb4ec0f8dc921",
"carrier_ip": "",
"customer_owned_ip": "",
"customer_owned_ipv4_pool": "",
"domain": "vpc",
"id": "eipalloc-0bc6f0725907c2b97",
"instance": "i-08b854173a9f65959",
"network_border_group": "ap-northeast-2",
"network_interface": "eni-03306af4a9f039398",
"private_dns": "ip-172-24-2-139.ap-northeast-2.compute.internal",
"private_ip": "172.24.2.139",
"public_dns": "ec2-43-200-67-243.ap-northeast-2.compute.amazonaws.com",
"public_ip": "43.200.67.243",
"public_ipv4_pool": "amazon",
"tags": {
"Name": "superset-eip"
},
"tags_all": {
"Name": "superset-eip"
},
"timeouts": null,
"vpc": true
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==",
"dependencies": [
"aws_instance.superset",
"aws_security_group.superset-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_instance",
"name": "superset",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0409b7ddbc59e3222",
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-08b854173a9f65959",
"associate_public_ip_address": true,
"availability_zone": "ap-northeast-2c",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_threads_per_core": 2,
"credit_specification": [
{
"cpu_credits": "unlimited"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [
{
"delete_on_termination": false,
"device_name": "/dev/xvdf",
"encrypted": true,
"iops": 300,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"snapshot_id": "",
"tags": {
"Name": "superset-ebs"
},
"throughput": 0,
"volume_id": "vol-00d7bfddea039e2a3",
"volume_size": 100,
"volume_type": "gp2"
}
],
"ebs_optimized": false,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-08b854173a9f65959",
"instance_initiated_shutdown_behavior": "stop",
"instance_state": "running",
"instance_type": "t3.small",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "kp-jay-bastion-datasaker",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "optional",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-03306af4a9f039398",
"private_dns": "i-08b854173a9f65959.ap-northeast-2.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": true,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "resource-name"
}
],
"private_ip": "172.24.2.139",
"public_dns": "ec2-43-200-67-243.ap-northeast-2.compute.amazonaws.com",
"public_ip": "43.200.67.243",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/sda1",
"encrypted": true,
"iops": 100,
"kms_key_id": "arn:aws:kms:ap-northeast-2:508259851457:key/fac33ef5-dbc0-4dcb-9be1-1862c6678bfb",
"tags": {},
"throughput": 0,
"volume_id": "vol-00b406bbc857781e8",
"volume_size": 30,
"volume_type": "gp2"
}
],
"secondary_private_ips": [],
"security_groups": [],
"source_dest_check": true,
"subnet_id": "subnet-0073a61bc56a68a3e",
"tags": {
"Name": "superset"
},
"tags_all": {
"Name": "superset"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-0a90049d737c4847c"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"aws_security_group.superset-allow-security"
]
}
]
},
{
"mode": "managed",
"type": "aws_route53_record",
"name": "superset",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 2,
"attributes": {
"alias": [],
"allow_overwrite": null,
"cidr_routing_policy": [],
"failover_routing_policy": [],
"fqdn": "superset1.kr.datasaker.io",
"geolocation_routing_policy": [],
"health_check_id": "",
"id": "Z072735718G25WNVKU834_superset1.kr.datasaker.io_A",
"latency_routing_policy": [],
"multivalue_answer_routing_policy": false,
"name": "superset1.kr.datasaker.io",
"records": [
"43.200.67.243"
],
"set_identifier": "",
"ttl": 300,
"type": "A",
"weighted_routing_policy": [],
"zone_id": "Z072735718G25WNVKU834"
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjIifQ==",
"dependencies": [
"aws_eip.superset_eip"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "superset-allow-security",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:security-group/sg-0a90049d737c4847c",
"description": "Allow inbound traffic",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [
"::/0"
],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
}
],
"id": "sg-0a90049d737c4847c",
"ingress": [
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "SSH",
"from_port": 22,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 22
},
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "TLS from superset",
"from_port": 443,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 443
}
],
"name": "superset-allow-security-new",
"name_prefix": "",
"owner_id": "508259851457",
"revoke_rules_on_delete": false,
"tags": {
"Name": "superset-allow-security"
},
"tags_all": {
"Name": "superset-allow-security"
},
"timeouts": null,
"vpc_id": "vpc-00ba2b0e9ad59f0ed"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0="
}
]
},
{
"mode": "managed",
"type": "aws_volume_attachment",
"name": "superset_ebs_attach",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"device_name": "/dev/xvdf",
"force_detach": null,
"id": "vai-1800967242",
"instance_id": "i-08b854173a9f65959",
"skip_destroy": null,
"stop_instance_before_detaching": null,
"timeouts": null,
"volume_id": "vol-00d7bfddea039e2a3"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwfX0=",
"dependencies": [
"aws_ebs_volume.superset_ebs",
"aws_instance.superset",
"aws_security_group.superset-allow-security"
]
}
]
}
],
"check_results": null
}

View File

@@ -0,0 +1,39 @@
#---------------------------------------------------------------#
# Network ID
variable "VPC_ID" {
default = "vpc-00ba2b0e9ad59f0ed"
}
variable "Network_CIDR" {
default = "172.24.0.0/19"
}
variable "Private_Subnet_ID_1" {
default = "subnet-024f0deda82039fa4"
}
variable "Private_Subnet_ID_2" {
default = "subnet-050d942fa1c46540a"
}
variable "Private_Subnet_ID_3" {
default = "subnet-0946eb806af7377be"
}
variable "Public_Subnet_ID_1" {
default = "subnet-00c363356f133411d"
}
variable "Public_Subnet_ID_2" {
default = "subnet-07aa5e879a262014d"
}
variable "Public_Subnet_ID_3" {
default = "subnet-0073a61bc56a68a3e"
}
variable "datasaker-io" {
default = "Z072735718G25WNVKU834"
}

View File

@@ -0,0 +1,22 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "4.36.1"
constraints = ">= 4.0.0"
hashes = [
"h1:04NI9x34nwhgghwevSGdsjssqy5zzvMsQg2Qjpmx/n0=",
"zh:19b16047b4f15e9b8538a2b925f1e860463984eed7d9bd78e870f3e884e827a7",
"zh:3c0db06a9a14b05a77f3fe1fc029a5fb153f4966964790ca8e71ecc3427d83f5",
"zh:3c7407a8229005e07bc274cbae6e3a464c441a88810bfc6eceb2414678fd08ae",
"zh:3d96fa82c037fafbd3e7f4edc1de32afb029416650f6e392c39182fc74a9e03a",
"zh:8f4f540c5f63d847c4b802ca84d148bb6275a3b0723deb09bf933a4800bc7209",
"zh:9802cb77472d6bcf24c196ce2ca6d02fac9db91558536325fec85f955b71a8a4",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:a263352433878c89832c2e38f4fd56cf96ae9969c13b5c710d5ba043cbd95743",
"zh:aca7954a5f458ceb14bf0c04c961c4e1e9706bf3b854a1e90a97d0b20f0fe6d3",
"zh:d78f400332e87a97cce2e080db9d01beb01f38f5402514a6705d6b8167e7730d",
"zh:e14bdc49be1d8b7d2543d5c58078c84b76051085e8e6715a895dcfe6034b6098",
"zh:f2e400b88c8de170bb5027922226da1e9a6614c03f2a6756c15c3b930c2f460c",
]
}

View File

@@ -0,0 +1,55 @@
terraform {
required_version = ">= 0.15.0"
required_providers {
aws = {
"configuration_aliases" = [aws.files]
"source" = "hashicorp/aws"
"version" = ">= 4.0.0"
}
}
}
provider "aws" {
alias = "files"
region = "ap-northeast-2"
}
output "vpc_prod_datasaker_id" {
value = aws_vpc.vpc-prod-datasaker.id
}
output "vpc_prod_datasaker_cidr_block" {
value = aws_vpc.vpc-prod-datasaker.cidr_block
}
resource "aws_vpc" "vpc-prod-datasaker" {
assign_generated_ipv6_cidr_block = true
cidr_block = "172.24.0.0/19"
enable_dns_hostnames = true
enable_dns_support = true
tags = {
"Name" = "vpc-prod-datasaker"
}
}
resource "aws_vpc_dhcp_options" "vpc-dhcp-prod-datasaker" {
domain_name = "ap-northeast-2.compute.internal"
domain_name_servers = ["AmazonProvidedDNS"]
tags = {
"Name" = "vpc-dhcp-prod-datasaker"
}
}
resource "aws_vpc_dhcp_options_association" "vpc-dhcp-asso-prod-datasaker" {
dhcp_options_id = aws_vpc_dhcp_options.vpc-dhcp-prod-datasaker.id
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_internet_gateway" "igw-prod-datasaker" {
tags = {
"Name" = "igw-prod-datasaker"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}

View File

@@ -0,0 +1,153 @@
output "sbn_dmz_prod_a_id" {
value = aws_subnet.sbn-prod-dmz-a.id
}
output "sbn_dmz_prod_b_id" {
value = aws_subnet.sbn-prod-dmz-b.id
}
output "sbn_dmz_prod_c_id" {
value = aws_subnet.sbn-prod-dmz-c.id
}
resource "aws_subnet" "sbn-prod-dmz-a" {
availability_zone = "ap-northeast-2a"
cidr_block = "172.24.0.0/24"
enable_resource_name_dns_a_record_on_launch = true
private_dns_hostname_type_on_launch = "resource-name"
tags = {
"Name"= "sbn-prod-dmz-a.datasaker"
"SubnetType" = "Utility"
"kubernetes.io/cluster/datasaker" = "owned"
"kubernetes.io/cluster/prod.datasaker.io" = "shared"
"kubernetes.io/role/nlb" = "1"
"kubernetes.io/role/internal-nlb" = "1"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_subnet" "sbn-prod-dmz-b" {
availability_zone = "ap-northeast-2b"
cidr_block = "172.24.1.0/24"
enable_resource_name_dns_a_record_on_launch = true
private_dns_hostname_type_on_launch = "resource-name"
tags = {
"Name" = "sbn-prod-dmz-b.datasaker"
"SubnetType" = "Utility"
"kubernetes.io/cluster/datasaker" = "owned"
"kubernetes.io/cluster/prod.datasaker.io" = "shared"
"kubernetes.io/role/nlb" = "1"
"kubernetes.io/role/internal-nlb" = "1"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_subnet" "sbn-prod-dmz-c" {
availability_zone = "ap-northeast-2c"
cidr_block = "172.24.2.0/24"
enable_resource_name_dns_a_record_on_launch = true
private_dns_hostname_type_on_launch = "resource-name"
tags = {
"Name" = "sbn-prod-dmz-c.datasaker"
"SubnetType" = "Utility"
"kubernetes.io/cluster/datasaker" = "owned"
"kubernetes.io/cluster/prod.datasaker.io" = "shared"
"kubernetes.io/role/nlb" = "1"
"kubernetes.io/role/internal-nlb" = "1"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_route_table" "rt-prod-datasaker-pub" {
tags = {
"Name" = "rt-prod-datasaker-pub"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_route" "r-0-0-0-0--0" {
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.igw-prod-datasaker.id
route_table_id = aws_route_table.rt-prod-datasaker-pub.id
}
resource "aws_route" "r-__--0" {
destination_ipv6_cidr_block = "::/0"
gateway_id = aws_internet_gateway.igw-prod-datasaker.id
route_table_id = aws_route_table.rt-prod-datasaker-pub.id
}
resource "aws_route_table_association" "rta-prod-dmz-a" {
route_table_id = aws_route_table.rt-prod-datasaker-pub.id
subnet_id = aws_subnet.sbn-prod-dmz-a.id
}
resource "aws_route_table_association" "rta-prod-dmz-b" {
route_table_id = aws_route_table.rt-prod-datasaker-pub.id
subnet_id = aws_subnet.sbn-prod-dmz-b.id
}
resource "aws_route_table_association" "rta-prod-dmz-c" {
route_table_id = aws_route_table.rt-prod-datasaker-pub.id
subnet_id = aws_subnet.sbn-prod-dmz-c.id
}
resource "aws_eip" "eip-bastion-prod-datasaker" {
vpc = true
tags = {
Name = "eip-bastion-prod-datasaker"
}
}
resource "aws_eip" "eip-natgw-prod-a-datasaker" {
vpc = true
tags = {
Name = "eip-natgw-prod-a-datasaker"
}
}
resource "aws_eip" "eip-natgw-prod-b-datasaker" {
vpc = true
tags = {
Name = "eip-natgw-prod-b-datasaker"
}
}
resource "aws_eip" "eip-natgw-prod-c-datasaker" {
vpc = true
tags = {
Name = "eip-natgw-prod-c-datasaker"
}
}
resource "aws_nat_gateway" "natgw-prod-a-datasaker" {
allocation_id = aws_eip.eip-natgw-prod-a-datasaker.id
subnet_id = aws_subnet.sbn-prod-dmz-a.id
tags = {
Name = "natgw-prod-a-datasaker"
}
depends_on = [aws_internet_gateway.igw-prod-datasaker]
}
resource "aws_nat_gateway" "natgw-prod-b-datasaker" {
allocation_id = aws_eip.eip-natgw-prod-b-datasaker.id
subnet_id = aws_subnet.sbn-prod-dmz-b.id
tags = {
Name = "natgw-prod-b-datasaker"
}
depends_on = [aws_internet_gateway.igw-prod-datasaker]
}
resource "aws_nat_gateway" "natgw-prod-c-datasaker" {
allocation_id = aws_eip.eip-natgw-prod-c-datasaker.id
subnet_id = aws_subnet.sbn-prod-dmz-c.id
tags = {
Name = "natgw-prod-c-datasaker"
}
depends_on = [aws_internet_gateway.igw-prod-datasaker]
}

View File

@@ -0,0 +1,102 @@
resource "aws_route_table" "private-prod-a-datasaker" {
tags = {
"Name" = "private-prod-a-datasaker"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_route_table" "private-prod-b-datasaker" {
tags = {
"Name" = "private-prod-b-datasaker"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_route_table" "private-prod-c-datasaker" {
tags = {
"Name" = "private-prod-c-datasaker"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_route" "route-private-rt-prod-a-datasaker-0-0-0-0--0" {
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.natgw-prod-a-datasaker.id
route_table_id = aws_route_table.private-prod-a-datasaker.id
}
resource "aws_route" "route-private-rt-prod-b-datasaker-0-0-0-0--0" {
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.natgw-prod-b-datasaker.id
route_table_id = aws_route_table.private-prod-b-datasaker.id
}
resource "aws_route" "route-private-rt-prod-c-datasaker-0-0-0-0--0" {
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.natgw-prod-c-datasaker.id
route_table_id = aws_route_table.private-prod-c-datasaker.id
}
resource "aws_subnet" "sbn-prod-a" {
availability_zone = "ap-northeast-2a"
cidr_block = "172.24.8.0/23"
enable_resource_name_dns_a_record_on_launch = true
private_dns_hostname_type_on_launch = "resource-name"
tags = {
"Name" = "sbn-prod-a-datasaker"
"SubnetType" = "Private"
"kubernetes.io/cluster/datasaker" = "owned"
"kubernetes.io/cluster/prod.datasaker.io" = "shared"
"kubernetes.io/role/nlb" = "1"
"kubernetes.io/role/internal-nlb" = "1"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_subnet" "sbn-prod-b" {
availability_zone = "ap-northeast-2b"
cidr_block = "172.24.10.0/23"
enable_resource_name_dns_a_record_on_launch = true
private_dns_hostname_type_on_launch = "resource-name"
tags = {
"Name" = "sbn-prod-b-datasaker"
"SubnetType" = "Private"
"kubernetes.io/cluster/datasaker" = "owned"
"kubernetes.io/cluster/prod.datasaker.io" = "shared"
"kubernetes.io/role/nlb" = "1"
"kubernetes.io/role/internal-nlb" = "1"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_subnet" "sbn-prod-c" {
availability_zone = "ap-northeast-2c"
cidr_block = "172.24.12.0/23"
enable_resource_name_dns_a_record_on_launch = true
private_dns_hostname_type_on_launch = "resource-name"
tags = {
"Name" = "sbn-prod-c-datasaker"
"SubnetType" = "Private"
"kubernetes.io/cluster/datasaker" = "owned"
"kubernetes.io/cluster/prod.datasaker.io" = "shared"
"kubernetes.io/role/nlb" = "1"
"kubernetes.io/role/internal-nlb" = "1"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_route_table_association" "rta-prod-a" {
route_table_id = aws_route_table.private-prod-a-datasaker.id
subnet_id = aws_subnet.sbn-prod-a.id
}
resource "aws_route_table_association" "rta-prod-b" {
route_table_id = aws_route_table.private-prod-b-datasaker.id
subnet_id = aws_subnet.sbn-prod-b.id
}
resource "aws_route_table_association" "rta-prod-c" {
route_table_id = aws_route_table.private-prod-c-datasaker.id
subnet_id = aws_subnet.sbn-prod-c.id
}

View File

@@ -0,0 +1,24 @@
resource "aws_instance" "bastion-k8s-prod-datasaker-io" {
ami = "ami-0b6591f49cf24e237"
instance_type = "t3.small"
count = 1
key_name = "kp-jay-bastion-datasaker"
vpc_security_group_ids = ["${aws_security_group.prod-dmz-sg-datasaker.id}"]
subnet_id = aws_subnet.sbn-prod-dmz-a.id
associate_public_ip_address = true
root_block_device {
delete_on_termination = true
encrypted = false
tags = {
Name = "bastion-k8s-prod-datasaker-io"
}
volume_size = 20
volume_type = "gp3"
iops = 3000
}
tags = {
Name = "bastion-k8s-prod-datasaker-io"
}
}

View File

@@ -0,0 +1,74 @@
resource "aws_security_group" "prod-dmz-sg-datasaker" {
description = "Security group dmz-datasaker"
name = "prod-dmz-sg-datasaker"
tags = {
"Name" = "prod-dmz-sg-datasaker"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_security_group_rule" "pub-only-exem" {
cidr_blocks = ["115.178.73.2/32","115.178.73.91/32"]
from_port = 22
protocol = "tcp"
security_group_id = aws_security_group.prod-dmz-sg-datasaker.id
to_port = 22
type = "ingress"
}
resource "aws_security_group_rule" "pub-out-any" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 0
protocol = "tcp"
security_group_id = aws_security_group.prod-dmz-sg-datasaker.id
to_port = 65535
type = "egress"
}
################################################################################
resource "aws_security_group" "prod-priv-sg-datasaker" {
description = "Security group prod-datasaker"
name = "prod-priv-sg-datasaker"
tags = {
"Name" = "prod-priv-sg-datasaker"
}
vpc_id = aws_vpc.vpc-prod-datasaker.id
}
resource "aws_security_group_rule" "priv-in-any" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 22
protocol = "tcp"
security_group_id = aws_security_group.prod-priv-sg-datasaker.id
to_port = 22
type = "ingress"
}
resource "aws_security_group_rule" "priv-in-icmp" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 8
protocol = "icmp"
security_group_id = aws_security_group.prod-priv-sg-datasaker.id
to_port = 8
type = "ingress"
}
resource "aws_security_group_rule" "priv-out-icmp" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 8
protocol = "icmp"
security_group_id = aws_security_group.prod-priv-sg-datasaker.id
to_port = 8
type = "egress"
}
resource "aws_security_group_rule" "priv-out-any" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 0
protocol = "tcp"
security_group_id = aws_security_group.prod-priv-sg-datasaker.id
to_port = 65535
type = "egress"
}

View File

@@ -0,0 +1,19 @@
resource "aws_alb" "nlb-prod-kr-ingress" {
name = "nlb-prod-kr-ingress"
internal = false
load_balancer_type = "network"
subnet_mapping {
subnet_id = aws_subnet.sbn-prod-dmz-a.id
}
subnet_mapping {
subnet_id = aws_subnet.sbn-prod-dmz-b.id
}
subnet_mapping {
subnet_id = aws_subnet.sbn-prod-dmz-c.id
}
enable_deletion_protection = true
tags = {
Environment = "nlb-prod-kr-ingress"
}
}

View File

@@ -0,0 +1,21 @@
resource "aws_alb_listener" "nlb-listener-http-prod" {
load_balancer_arn = aws_alb.nlb-prod-kr-ingress.arn
port = "443"
protocol = "TCP"
default_action {
type = "forward"
target_group_arn = aws_alb_target_group.tg-prod-kr-tcp-30001.arn
}
}
resource "aws_alb_listener" "nlb-listener-tls-prod" {
load_balancer_arn = aws_alb.nlb-prod-kr-ingress.arn
port = "80"
protocol = "TCP"
default_action {
type = "forward"
target_group_arn = aws_alb_target_group.tg-prod-kr-tcp-30000.arn
}
}

View File

@@ -0,0 +1,85 @@
variable "k8s-prod-master-2a" {
default = "i-082bb4e2813521de0"
}
variable "k8s-prod-master-2b" {
default = "i-045a073c83b7f23c2"
}
variable "k8s-prod-master-2c" {
default = "i-049f35ffe56207c62"
}
##################################################################################
resource "aws_alb_target_group" "tg-prod-kr-tcp-30000" {
name = "tg-prod-kr-tcp-30000"
port = 30000
protocol = "TCP"
vpc_id = aws_vpc.vpc-prod-datasaker.id
health_check {
interval = 30
protocol = "TCP"
healthy_threshold = 3
unhealthy_threshold = 3
}
}
resource "aws_alb_target_group_attachment" "prod-master-http-2a" {
target_group_arn = "${aws_alb_target_group.tg-prod-kr-tcp-30000.arn}"
target_id = "${var.k8s-prod-master-2a}"
port = 30000
}
resource "aws_alb_target_group_attachment" "prod-master-http-2b" {
target_group_arn = "${aws_alb_target_group.tg-prod-kr-tcp-30000.arn}"
target_id = "${var.k8s-prod-master-2b}"
port = 30000
}
resource "aws_alb_target_group_attachment" "prod-master-http-2c" {
target_group_arn = "${aws_alb_target_group.tg-prod-kr-tcp-30000.arn}"
target_id = "${var.k8s-prod-master-2c}"
port = 30000
}
###############################################################################
resource "aws_alb_target_group" "tg-prod-kr-tcp-30001" {
name = "tg-prod-kr-tcp-30001"
port = 30001
protocol = "TCP"
vpc_id = aws_vpc.vpc-prod-datasaker.id
health_check {
interval = 30
protocol = "TCP"
healthy_threshold = 3
unhealthy_threshold = 3
}
}
resource "aws_alb_target_group_attachment" "prod-master-tls-2a" {
target_group_arn = "${aws_alb_target_group.tg-prod-kr-tcp-30001.arn}"
target_id = "${var.k8s-prod-master-2a}"
port = 30001
}
resource "aws_alb_target_group_attachment" "prod-master-tls-2b" {
target_group_arn = "${aws_alb_target_group.tg-prod-kr-tcp-30001.arn}"
target_id = "${var.k8s-prod-master-2b}"
port = 30001
}
resource "aws_alb_target_group_attachment" "prod-master-tls-2c" {
target_group_arn = "${aws_alb_target_group.tg-prod-kr-tcp-30001.arn}"
target_id = "${var.k8s-prod-master-2c}"
port = 30001
}
###############################################################################

View File

@@ -0,0 +1,132 @@
variable "datasaker-ai" {
default = "Z06479772L265DHVJW30F"
}
variable "datasaker-com" {
default = "Z0218361HIZ723RV9EX4"
}
variable "datasaker-io" {
default = "Z072735718G25WNVKU834"
}
variable "datasaker-co-kr" {
default = "Z06528191YJHOMRBYTXXT"
}
variable "datasaker-net" {
default = "Z072720912UR7SY03M9F8"
}
##############################################################################
resource "aws_route53_record" "prod-dns-krakend" {
zone_id = "${var.datasaker-io}"
name = "api.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_record" "prod-dns-keycloak" {
zone_id = "${var.datasaker-io}"
name = "auth.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_record" "prod-dns-dsk-agentmanager" {
zone_id = "${var.datasaker-io}"
name = "am.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_record" "prod-dns-datagate-metric" {
zone_id = "${var.datasaker-io}"
name = "megate.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_record" "prod-dns-datagate-jaeger" {
zone_id = "${var.datasaker-io}"
name = "trgate.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_record" "prod-dns-datagate-manifest" {
zone_id = "${var.datasaker-io}"
name = "magate.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_record" "prod-dns-loggate" {
zone_id = "${var.datasaker-io}"
name = "lgate.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_record" "prod-dns-ui" {
zone_id = "${var.datasaker-io}"
name = "app.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_record" "prod-test" {
zone_id = "${var.datasaker-io}"
name = "kubedash.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_record" "prod-test2" {
zone_id = "${var.datasaker-io}"
name = "jenkins-prod.kr.datasaker.io"
type = "A"
alias {
name = aws_alb.nlb-prod-kr-ingress.dns_name
zone_id = aws_alb.nlb-prod-kr-ingress.zone_id
evaluate_target_health = true
}
}

View File

@@ -0,0 +1,12 @@
#!/bin/bash
sudo curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
sudo curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
sudo chmod 700 get_helm.sh
sudo ./get_helm.sh
echo "source <(kubectl completion bash)" >> /etc/profile
echo "alias k=kubectl" >> /etc/profile
echo "complete -o default -F __start_kubectl k" >> /etc/profile

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
provider "aws" {
region = var.aws_region
}
resource "random_pet" "env" {
length = 2
separator = "_"
}

View File

@@ -0,0 +1,55 @@
resource "aws_kms_key" "vault" {
description = "Vault unseal key"
deletion_window_in_days = 10
tags = {
Name = "vault-kms-unseal-${random_pet.env.id}"
}
}
resource "aws_kms_alias" "vault-a" {
name = "alias/prod-vault-auto-unseal"
target_key_id = aws_kms_key.vault.key_id
}
data "aws_iam_policy_document" "assume_role" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["ec2.amazonaws.com"]
}
}
}
data "aws_iam_policy_document" "vault-kms-unseal" {
statement {
sid = "VaultKMSUnseal"
effect = "Allow"
resources = [aws_kms_key.vault.arn]
actions = [
"kms:Encrypt",
"kms:Decrypt",
"kms:DescribeKey",
]
}
}
resource "aws_iam_role" "vault-kms-unseal" {
name = "vault-kms-role-${random_pet.env.id}"
assume_role_policy = data.aws_iam_policy_document.assume_role.json
}
resource "aws_iam_role_policy" "vault-kms-unseal" {
name = "Vault-KMS-Unseal-${random_pet.env.id}"
role = aws_iam_role.vault-kms-unseal.id
policy = data.aws_iam_policy_document.vault-kms-unseal.json
}
resource "aws_iam_instance_profile" "vault-kms-unseal" {
name = "vault-kms-unseal-${random_pet.env.id}"
role = aws_iam_role.vault-kms-unseal.name
}

View File

@@ -0,0 +1,3 @@
terraform {
required_version = ">= 0.12"
}

View File

@@ -0,0 +1,7 @@
variable "aws_region" {
default = "ap-northeast-2"
}
variable "aws_zone" {
default = "ap-northeast-2b"
}

View File

@@ -0,0 +1,31 @@
# Vault Auto-unseal using AWS KMS
These assets are provided to perform the tasks described in the [Vault Auto-unseal with AWS KMS](https://learn.hashicorp.com/vault/operations/ops-autounseal-aws-kms) guide.
---
## Demo Steps
### Setup
1. Set this location as your working directory
1. Set your AWS credentials as environment variables: `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
1. Set Vault Enterprise URL in a file named `terraform.tfvars` (see `terraform.tfvars.example`)
### Commands Cheat Sheet
```bash
# Pull necessary plugins
$ terraform init
$ terraform plan
# Output provides the SSH instruction
$ terraform apply
#----------------------------------
# Clean up...
$ terraform destroy -force
$ rm -rf .terraform terraform.tfstate* private.key
```

View File

@@ -0,0 +1,272 @@
{
"version": 4,
"terraform_version": "1.3.1",
"serial": 14,
"lineage": "e3e93a0f-93ed-63a2-17ab-4fa507053640",
"outputs": {},
"resources": [
{
"mode": "data",
"type": "aws_iam_policy_document",
"name": "assume_role",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "1903849331",
"json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Action\": \"sts:AssumeRole\",\n \"Principal\": {\n \"Service\": \"ec2.amazonaws.com\"\n }\n }\n ]\n}",
"override_json": null,
"override_policy_documents": null,
"policy_id": null,
"source_json": null,
"source_policy_documents": null,
"statement": [
{
"actions": [
"sts:AssumeRole"
],
"condition": [],
"effect": "Allow",
"not_actions": [],
"not_principals": [],
"not_resources": [],
"principals": [
{
"identifiers": [
"ec2.amazonaws.com"
],
"type": "Service"
}
],
"resources": [],
"sid": ""
}
],
"version": "2012-10-17"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_iam_policy_document",
"name": "vault-kms-unseal",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "2560863897",
"json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"VaultKMSUnseal\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"kms:Encrypt\",\n \"kms:DescribeKey\",\n \"kms:Decrypt\"\n ],\n \"Resource\": \"arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1\"\n }\n ]\n}",
"override_json": null,
"override_policy_documents": null,
"policy_id": null,
"source_json": null,
"source_policy_documents": null,
"statement": [
{
"actions": [
"kms:Decrypt",
"kms:DescribeKey",
"kms:Encrypt"
],
"condition": [],
"effect": "Allow",
"not_actions": [],
"not_principals": [],
"not_resources": [],
"principals": [],
"resources": [
"arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1"
],
"sid": "VaultKMSUnseal"
}
],
"version": "2012-10-17"
},
"sensitive_attributes": []
}
]
},
{
"mode": "managed",
"type": "aws_iam_instance_profile",
"name": "vault-kms-unseal",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:instance-profile/vault-kms-unseal-mighty_terrier",
"create_date": "2022-12-12T08:20:12Z",
"id": "vault-kms-unseal-mighty_terrier",
"name": "vault-kms-unseal-mighty_terrier",
"name_prefix": null,
"path": "/",
"role": "vault-kms-role-mighty_terrier",
"tags": {},
"tags_all": {},
"unique_id": "AIPAXMVVF3TAVAWIQ62TS"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_role.vault-kms-unseal",
"data.aws_iam_policy_document.assume_role",
"random_pet.env"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_role",
"name": "vault-kms-unseal",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:role/vault-kms-role-mighty_terrier",
"assume_role_policy": "{\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"ec2.amazonaws.com\"},\"Sid\":\"\"}],\"Version\":\"2012-10-17\"}",
"create_date": "2022-12-12T08:20:10Z",
"description": "",
"force_detach_policies": false,
"id": "vault-kms-role-mighty_terrier",
"inline_policy": [
{
"name": "Vault-KMS-Unseal-mighty_terrier",
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"VaultKMSUnseal\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"kms:Encrypt\",\n \"kms:DescribeKey\",\n \"kms:Decrypt\"\n ],\n \"Resource\": \"arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1\"\n }\n ]\n}"
}
],
"managed_policy_arns": [],
"max_session_duration": 3600,
"name": "vault-kms-role-mighty_terrier",
"name_prefix": "",
"path": "/",
"permissions_boundary": null,
"tags": {},
"tags_all": {},
"unique_id": "AROAXMVVF3TA3MJDOSJFJ"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"data.aws_iam_policy_document.assume_role",
"random_pet.env"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_role_policy",
"name": "vault-kms-unseal",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "vault-kms-role-mighty_terrier:Vault-KMS-Unseal-mighty_terrier",
"name": "Vault-KMS-Unseal-mighty_terrier",
"name_prefix": null,
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"VaultKMSUnseal\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"kms:Encrypt\",\n \"kms:DescribeKey\",\n \"kms:Decrypt\"\n ],\n \"Resource\": \"arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1\"\n }\n ]\n}",
"role": "vault-kms-role-mighty_terrier"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_role.vault-kms-unseal",
"data.aws_iam_policy_document.assume_role",
"data.aws_iam_policy_document.vault-kms-unseal",
"random_pet.env"
]
}
]
},
{
"mode": "managed",
"type": "aws_kms_alias",
"name": "vault-a",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:kms:ap-northeast-2:508259851457:alias/prod-vault-auto-unseal",
"id": "alias/prod-vault-auto-unseal",
"name": "alias/prod-vault-auto-unseal",
"name_prefix": "",
"target_key_arn": "arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1",
"target_key_id": "c7641fb7-1689-4ec0-80ea-8b931deeb5a1"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_kms_key.vault",
"random_pet.env"
]
}
]
},
{
"mode": "managed",
"type": "aws_kms_key",
"name": "vault",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1",
"bypass_policy_lockout_safety_check": false,
"custom_key_store_id": "",
"customer_master_key_spec": "SYMMETRIC_DEFAULT",
"deletion_window_in_days": 10,
"description": "Vault unseal key",
"enable_key_rotation": false,
"id": "c7641fb7-1689-4ec0-80ea-8b931deeb5a1",
"is_enabled": true,
"key_id": "c7641fb7-1689-4ec0-80ea-8b931deeb5a1",
"key_usage": "ENCRYPT_DECRYPT",
"multi_region": false,
"policy": "{\"Id\":\"key-default-1\",\"Statement\":[{\"Action\":\"kms:*\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::508259851457:root\"},\"Resource\":\"*\",\"Sid\":\"Enable IAM User Permissions\"}],\"Version\":\"2012-10-17\"}",
"tags": {
"Name": "vault-kms-unseal-mighty_terrier"
},
"tags_all": {
"Name": "vault-kms-unseal-mighty_terrier"
}
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"random_pet.env"
]
}
]
},
{
"mode": "managed",
"type": "random_pet",
"name": "env",
"provider": "provider[\"registry.terraform.io/hashicorp/random\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "mighty_terrier",
"keepers": null,
"length": 2,
"prefix": null,
"separator": "_"
},
"sensitive_attributes": []
}
]
}
],
"check_results": []
}

View File

@@ -0,0 +1,243 @@
{
"version": 4,
"terraform_version": "1.3.1",
"serial": 7,
"lineage": "e3e93a0f-93ed-63a2-17ab-4fa507053640",
"outputs": {},
"resources": [
{
"mode": "data",
"type": "aws_iam_policy_document",
"name": "assume_role",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "1903849331",
"json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Action\": \"sts:AssumeRole\",\n \"Principal\": {\n \"Service\": \"ec2.amazonaws.com\"\n }\n }\n ]\n}",
"override_json": null,
"override_policy_documents": null,
"policy_id": null,
"source_json": null,
"source_policy_documents": null,
"statement": [
{
"actions": [
"sts:AssumeRole"
],
"condition": [],
"effect": "Allow",
"not_actions": [],
"not_principals": [],
"not_resources": [],
"principals": [
{
"identifiers": [
"ec2.amazonaws.com"
],
"type": "Service"
}
],
"resources": [],
"sid": ""
}
],
"version": "2012-10-17"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "aws_iam_policy_document",
"name": "vault-kms-unseal",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "2560863897",
"json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"VaultKMSUnseal\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"kms:Encrypt\",\n \"kms:DescribeKey\",\n \"kms:Decrypt\"\n ],\n \"Resource\": \"arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1\"\n }\n ]\n}",
"override_json": null,
"override_policy_documents": null,
"policy_id": null,
"source_json": null,
"source_policy_documents": null,
"statement": [
{
"actions": [
"kms:Decrypt",
"kms:DescribeKey",
"kms:Encrypt"
],
"condition": [],
"effect": "Allow",
"not_actions": [],
"not_principals": [],
"not_resources": [],
"principals": [],
"resources": [
"arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1"
],
"sid": "VaultKMSUnseal"
}
],
"version": "2012-10-17"
},
"sensitive_attributes": []
}
]
},
{
"mode": "managed",
"type": "aws_iam_instance_profile",
"name": "vault-kms-unseal",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:instance-profile/vault-kms-unseal-mighty_terrier",
"create_date": "2022-12-12T08:20:12Z",
"id": "vault-kms-unseal-mighty_terrier",
"name": "vault-kms-unseal-mighty_terrier",
"name_prefix": null,
"path": "/",
"role": "vault-kms-role-mighty_terrier",
"tags": null,
"tags_all": {},
"unique_id": "AIPAXMVVF3TAVAWIQ62TS"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_role.vault-kms-unseal",
"data.aws_iam_policy_document.assume_role",
"random_pet.env"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_role",
"name": "vault-kms-unseal",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:iam::508259851457:role/vault-kms-role-mighty_terrier",
"assume_role_policy": "{\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"ec2.amazonaws.com\"},\"Sid\":\"\"}],\"Version\":\"2012-10-17\"}",
"create_date": "2022-12-12T08:20:10Z",
"description": "",
"force_detach_policies": false,
"id": "vault-kms-role-mighty_terrier",
"inline_policy": [],
"managed_policy_arns": [],
"max_session_duration": 3600,
"name": "vault-kms-role-mighty_terrier",
"name_prefix": "",
"path": "/",
"permissions_boundary": null,
"tags": null,
"tags_all": {},
"unique_id": "AROAXMVVF3TA3MJDOSJFJ"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"data.aws_iam_policy_document.assume_role",
"random_pet.env"
]
}
]
},
{
"mode": "managed",
"type": "aws_iam_role_policy",
"name": "vault-kms-unseal",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "vault-kms-role-mighty_terrier:Vault-KMS-Unseal-mighty_terrier",
"name": "Vault-KMS-Unseal-mighty_terrier",
"name_prefix": null,
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"VaultKMSUnseal\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"kms:Encrypt\",\n \"kms:DescribeKey\",\n \"kms:Decrypt\"\n ],\n \"Resource\": \"arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1\"\n }\n ]\n}",
"role": "vault-kms-role-mighty_terrier"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_iam_role.vault-kms-unseal",
"aws_kms_key.vault",
"data.aws_iam_policy_document.assume_role",
"data.aws_iam_policy_document.vault-kms-unseal",
"random_pet.env"
]
}
]
},
{
"mode": "managed",
"type": "aws_kms_key",
"name": "vault",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:kms:ap-northeast-2:508259851457:key/c7641fb7-1689-4ec0-80ea-8b931deeb5a1",
"bypass_policy_lockout_safety_check": false,
"custom_key_store_id": "",
"customer_master_key_spec": "SYMMETRIC_DEFAULT",
"deletion_window_in_days": 10,
"description": "Vault unseal key",
"enable_key_rotation": false,
"id": "c7641fb7-1689-4ec0-80ea-8b931deeb5a1",
"is_enabled": true,
"key_id": "c7641fb7-1689-4ec0-80ea-8b931deeb5a1",
"key_usage": "ENCRYPT_DECRYPT",
"multi_region": false,
"policy": "{\"Id\":\"key-default-1\",\"Statement\":[{\"Action\":\"kms:*\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::508259851457:root\"},\"Resource\":\"*\",\"Sid\":\"Enable IAM User Permissions\"}],\"Version\":\"2012-10-17\"}",
"tags": {
"Name": "vault-kms-unseal-mighty_terrier"
},
"tags_all": {
"Name": "vault-kms-unseal-mighty_terrier"
}
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"random_pet.env"
]
}
]
},
{
"mode": "managed",
"type": "random_pet",
"name": "env",
"provider": "provider[\"registry.terraform.io/hashicorp/random\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "mighty_terrier",
"keepers": null,
"length": 2,
"prefix": null,
"separator": "_"
},
"sensitive_attributes": []
}
]
}
],
"check_results": []
}