Skip to content

Commit

Permalink
🐛 fix(main.tf): fix service-linked-role creation
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Sep 3, 2024
1 parent f65aa79 commit feb202e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ The module deploys Karpenter needed AWS resources, namely in IAM. It copies the
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_ecr_image.karpenter_image](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecr_image) | data source |
| [aws_ecr_image.kubectl_image](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecr_image) | data source |
| [aws_iam_roles.roles](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_roles) | data source |
| [aws_subnets.container_subnets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |

## Inputs
Expand Down
8 changes: 0 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,11 @@ resource "aws_iam_instance_profile" "karpenter_node_instance_profile" {
role = module.karpenter_resources.node_iam_role_name
}

# Query to see if service-linked role exists
data "aws_iam_roles" "roles" {
path_prefix = "/aws-reserved/spot.amazonaws.com/${var.cluster_name}"
}

# Permission for spot
resource "aws_iam_service_linked_role" "ec2_spot" {
count = data.aws_iam_roles.roles == null ? 1 : 0
aws_service_name = "spot.amazonaws.com"
custom_suffix = var.cluster_name
}


# SHOULD PROBABLY PUT THESE OBJECTS INTO A HELM CHART
# Create karpenter default
resource "kubectl_manifest" "karpenter_ec2_node_class" {
Expand Down

0 comments on commit feb202e

Please sign in to comment.