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

fix: Ensure karpenter and velero resources are not created when they are not enabled #149

Merged
merged 3 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.3
rev: v1.78.0
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 +2257,8 @@ locals {
}

data "aws_iam_role" "karpenter" {
name = var.karpenter_instance_profile.iam_role_name
count = var.enable_karpenter ? 1 : 0
name = var.karpenter_instance_profile.iam_role_name
}

data "aws_iam_policy_document" "karpenter" {
Expand Down Expand Up @@ -2294,7 +2295,7 @@ data "aws_iam_policy_document" "karpenter" {

statement {
actions = ["iam:PassRole"]
resources = [data.aws_iam_role.karpenter.arn]
resources = [data.aws_iam_role.karpenter[0].arn]
}

statement {
Expand Down Expand Up @@ -2744,9 +2745,9 @@ module "secrets_store_csi_driver_provider_aws" {
locals {
velero_name = "velero"
velero_service_account = try(var.velero.service_account_name, "${local.velero_name}-server")
velero_backup_s3_bucket = split(":", var.velero.s3_backup_location)
velero_backup_s3_bucket_arn = try(split("/", var.velero.s3_backup_location)[0], var.velero.s3_backup_location)
velero_backup_s3_bucket_name = try(split("/", local.velero_backup_s3_bucket[5])[0], local.velero_backup_s3_bucket[5])
velero_backup_s3_bucket = try(split(":", var.velero.s3_backup_location), [])
velero_backup_s3_bucket_arn = try(split("/", var.velero.s3_backup_location)[0], var.velero.s3_backup_location, "")
velero_backup_s3_bucket_name = try(split("/", local.velero_backup_s3_bucket[5])[0], local.velero_backup_s3_bucket[5], "")
velero_backup_s3_bucket_prefix = try(split("/", var.velero.s3_backup_location)[1], "")
}

Expand Down