provider "aws" { region = "ap-northeast-2" } resource "aws_iam_role" "iam-role" { name = "eks-cluster-test" # Terraform's "jsonencode" function converts a # Terraform expression result to valid JSON syntax. assume_role_policy = jsonencode({ "Version" : "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Principal" : { "Service" : [ "eks.amazonaws.com" ] }, "Action" : "sts:AssumeRole" } ] }) tags = { tag-key = "eks-cluster-rule" } }