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: Complete-k8s output & add try to prometheus policy element index #1195

Merged
merged 5 commits into from
Nov 19, 2022
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
1 change: 1 addition & 0 deletions examples/complete-kubernetes-addons/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ module "eks_blueprints_kubernetes_addons" {
amazon_prometheus_workspace_endpoint = module.managed_prometheus.workspace_prometheus_endpoint

enable_aws_for_fluentbit = true
aws_for_fluentbit_create_cw_log_group = false
aws_for_fluentbit_cw_log_group_retention = 30
aws_for_fluentbit_helm_config = {
create_namespace = true
Expand Down
2 changes: 1 addition & 1 deletion examples/complete-kubernetes-addons/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ output "kyverno_addon" {

output "kyverno_values" {
description = "Values used in the Kyverno Helm release"
value = jsondecode(module.eks_blueprints_kubernetes_addons.kyverno.release_metadata[0].values)
value = try(jsondecode(module.eks_blueprints_kubernetes_addons.kyverno.release_metadata[0].values), null)
}
2 changes: 1 addition & 1 deletion modules/kubernetes-addons/prometheus/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ module "irsa_amp_ingest" {
kubernetes_namespace = local.namespace

kubernetes_service_account = local.ingest_service_account
irsa_iam_policies = [aws_iam_policy.ingest[0].arn]
irsa_iam_policies = [try(aws_iam_policy.ingest[0].arn, "")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understand this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure if this is the best solution, but right now if you are trying to cleanup the complete-k8s addon for example, you'll face the failure explained in the details of the PR where aws_iam_policy.ingest is empty tuple , when you try to the delete the resource (that was already deleted), because it's under a condition (if mng prometheus is enabled), this was the cleanest workaround I found. Terraform is trying to use the resource because it's also being used in the rest of the prometheus module and because it has that count condition

Copy link
Contributor

Choose a reason for hiding this comment

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

it fixes an error so for now we'll go with it - we can revisit later to see if there is a better or more idiomatic way to resolve this

irsa_iam_role_path = var.addon_context.irsa_iam_role_path
irsa_iam_permissions_boundary = var.addon_context.irsa_iam_permissions_boundary
eks_cluster_id = var.addon_context.eks_cluster_id
Expand Down