Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add EKS Fargate support #1067

Merged
merged 38 commits into from
Nov 7, 2020

Conversation

barryib
Copy link
Member

@barryib barryib commented Oct 26, 2020

PR o'clock

Description

This PR is taken from #866 and add suggested review.

Checklist

@barryib barryib mentioned this pull request Oct 26, 2020
2 tasks
@barryib barryib marked this pull request as draft October 26, 2020 21:15
@barryib barryib marked this pull request as ready for review November 2, 2020 20:57
@barryib
Copy link
Member Author

barryib commented Nov 2, 2020

@itssimon I updated your PR and fixed suggested reviews. I've also add example. Can you review this please.

Community: We need help to test this. I would like to merge this during the week.

@barryib barryib linked an issue Nov 2, 2020 that may be closed by this pull request
4 tasks
@barryib
Copy link
Member Author

barryib commented Nov 2, 2020

@sc250024 sounds like you're also working on fargate support. Can you review this please ?

@barryib barryib requested a review from a team November 4, 2020 21:24
Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good.

modules/fargate/variables.tf Show resolved Hide resolved
@@ -0,0 +1,10 @@
locals {
create_eks = var.create_eks && length(var.fargate_profiles) > 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to introduce another variable that should be known in advance (eg, type boolean) to be able to use it in count. Something like create_eks_fargate = true.

The way it is written now fargate_profiles can't contain references to not-yet-created resources and modules inside of the value.

BARRY Thierno Ibrahima (Canal Plus Prestataire) added 2 commits November 5, 2020 21:46
policy_arn = "${var.iam_policy_arn_prefix}/AmazonEKSFargatePodExecutionRolePolicy"
role = aws_iam_role.eks_fargate_pod[0].name
}

resource "aws_eks_fargate_profile" "this" {
for_each = local.create_eks ? local.fargate_profiles_expanded : {}
for_each = var.create_eks ? local.fargate_profiles_expanded : {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This for_each will fail if local.fargate_profiles_expanded contains not-yet-known values (as you've just replaced for local.create_eks). I am not sure what is the best solution for this here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var.fargate_profiles and local.fargate_profiles_expanded are maps and to work with for_each, their keys must be known during plan. If keys are known, I think the Terraform will wait correctly for aws_eks_fargate_profile creation if there is a not yet known values inside local.fargate_profiles_expanded.

So length(var.fargate_profiles) will be known because keys must be known.

@barryib barryib merged commit 0d77e30 into terraform-aws-modules:master Nov 7, 2020
@barryib barryib deleted the tba/fargate branch November 7, 2020 22:03
@barryib
Copy link
Member Author

barryib commented Nov 7, 2020

Thanks again @itssimon for all your work on this feature.

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Fargate for EKS
3 participants