Skip to content

Commit

Permalink
fix: Fixed incorrect example of iam-eks-role (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbabenko authored Jan 21, 2022
1 parent 7bb7652 commit c26c44e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
13 changes: 11 additions & 2 deletions examples/iam-eks-role/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,29 @@ Run `terraform destroy` when you don't need these resources.
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.6 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.23 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2 |

## Providers

No providers.
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.23 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | ~> 18.0 |
| <a name="module_iam_eks_role"></a> [iam\_eks\_role](#module\_iam\_eks\_role) | ../../modules/iam-eks-role | n/a |

## Resources

No resources.
| Name | Type |
|------|------|
| [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource |
| [aws_subnet_ids.all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
| [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |

## Inputs

Expand Down
36 changes: 31 additions & 5 deletions examples/iam-eks-role/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ module "iam_eks_role" {
role_name = "my-app"

cluster_service_accounts = {
"cluster1" = ["default:my-app"]
"cluster2" = [
"default:my-app",
"canary:my-app",
]
(random_pet.this.id) = ["default:my-app", "canary:my-app"]
}

provider_url_sa_pairs = {
Expand All @@ -30,3 +26,33 @@ module "iam_eks_role" {
"arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
]
}

##################
# Extra resources
##################

resource "random_pet" "this" {
length = 2
}

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 18.0"

cluster_name = random_pet.this.id
cluster_version = "1.21"

vpc_id = data.aws_vpc.default.id
subnet_ids = data.aws_subnet_ids.all.ids
}

##################################################################
# Data sources to get VPC, subnet, security group and AMI details
##################################################################
data "aws_vpc" "default" {
default = true
}

data "aws_subnet_ids" "all" {
vpc_id = data.aws_vpc.default.id
}
3 changes: 2 additions & 1 deletion examples/iam-eks-role/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ terraform {
required_version = ">= 0.12.6"

required_providers {
aws = ">= 2.23"
aws = ">= 2.23"
random = ">= 2"
}
}

0 comments on commit c26c44e

Please sign in to comment.