From fcd4abb5708fa10569e407f028e1dee871c1d3c8 Mon Sep 17 00:00:00 2001 From: Nick Janetakis Date: Mon, 17 Jan 2022 12:17:33 -0500 Subject: [PATCH] docs: Add use case examples to the 18.x upgrade guide (#1783) --- UPGRADE-18.0.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/UPGRADE-18.0.md b/UPGRADE-18.0.md index 8c1bd66..2d00e6f 100644 --- a/UPGRADE-18.0.md +++ b/UPGRADE-18.0.md @@ -551,3 +551,36 @@ module "cluster_after" { } } ``` + +### Attaching an IAM role policy to a Fargate profile + +#### Before 17.x + +```hcl +resource "aws_iam_role_policy_attachment" "default" { + role = module.eks.fargate_iam_role_name + policy_arn = aws_iam_policy.default.arn +} +``` + +#### After 18.x + +```hcl +# Attach the policy to an "example" Fargate profile +resource "aws_iam_role_policy_attachment" "default" { + role = module.eks.fargate_profiles["example"].iam_role_name + policy_arn = aws_iam_policy.default.arn +} +``` + +Or: + +```hcl +# Attach the policy to all Fargate profiles +resource "aws_iam_role_policy_attachment" "default" { + for_each = module.eks.fargate_profiles + + role = each.value.iam_role_name + policy_arn = aws_iam_policy.default.arn +} +```