Skip to content

Commit

Permalink
fix(main.tf): custom_suffix does not apply for spot
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Sep 4, 2024
1 parent feb202e commit b0a84a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ 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
7 changes: 7 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,18 @@ 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"
}

# 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"
}


# 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 b0a84a4

Please sign in to comment.