Skip to content

Commit

Permalink
[tf][aws] add aws terraform for validator
Browse files Browse the repository at this point in the history
  • Loading branch information
sherry-x authored and bors-libra committed Dec 13, 2021
1 parent 96261c5 commit 3a764a0
Show file tree
Hide file tree
Showing 22 changed files with 2,574 additions and 1 deletion.
179 changes: 179 additions & 0 deletions terraform/validator/aws/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions terraform/validator/aws/auth.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
data "aws_iam_policy_document" "eks-assume-role" {
statement {
actions = ["sts:AssumeRole"]

principals {
type = "Service"
identifiers = ["eks.amazonaws.com"]
}
}
}

resource "aws_iam_role" "cluster" {
name = "diem-${local.workspace_name}-cluster"
path = var.iam_path
assume_role_policy = data.aws_iam_policy_document.eks-assume-role.json
permissions_boundary = var.permissions_boundary_policy
tags = local.default_tags
}

resource "aws_iam_role_policy_attachment" "cluster-cluster" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
role = aws_iam_role.cluster.name
}

resource "aws_iam_role_policy_attachment" "cluster-service" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSServicePolicy"
role = aws_iam_role.cluster.name
}

data "aws_iam_policy_document" "ec2-assume-role" {
statement {
actions = ["sts:AssumeRole"]

principals {
type = "Service"
identifiers = ["ec2.amazonaws.com"]
}
}
}

resource "aws_iam_role" "nodes" {
name = "diem-${local.workspace_name}-nodes"
path = var.iam_path
assume_role_policy = data.aws_iam_policy_document.ec2-assume-role.json
permissions_boundary = var.permissions_boundary_policy
tags = local.default_tags
}

resource "aws_iam_instance_profile" "nodes" {
name = "diem-${local.workspace_name}-nodes"
role = aws_iam_role.nodes.name
path = var.iam_path
}

resource "aws_iam_role_policy_attachment" "nodes-node" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy"
role = aws_iam_role.nodes.name
}

resource "aws_iam_role_policy_attachment" "nodes-cni" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
role = aws_iam_role.nodes.name
}

resource "aws_iam_role_policy_attachment" "nodes-ecr" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
role = aws_iam_role.nodes.name
}
2 changes: 2 additions & 0 deletions terraform/validator/aws/aws-calico/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*~
*.swp
5 changes: 5 additions & 0 deletions terraform/validator/aws/aws-calico/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: aws-calico
version: 1.6.0
description: Calico network plugin for AWS
home: https://github.com/aws/amazon-vpc-cni-k8s
Loading

0 comments on commit 3a764a0

Please sign in to comment.