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

Cycle dependencies on AWS Terraform Module 5.0.1 #306

Open
flamarion opened this issue Nov 14, 2024 · 3 comments
Open

Cycle dependencies on AWS Terraform Module 5.0.1 #306

flamarion opened this issue Nov 14, 2024 · 3 comments
Assignees

Comments

@flamarion
Copy link
Contributor

Cycle dependencies when using the AWS Terraform module 5.1 for new installations or when updating from version 5.0.1 to the 5.1

Code used to deploy a new installation

data "aws_route53_zone" "zone" {
  name = "sandbox-aws.wandb.ml"
}
module "wandb_infra" {
  source                         = "wandb/wandb/aws"
  version                        = "~>5.0"
  # source = "../../terraform-aws-wandb"
  license                        = xxxxxxxxx
  allowed_inbound_cidr           = ["0.0.0.0/0"]
  allowed_inbound_ipv6_cidr      = ["::/0"]
  eks_cluster_version            = "1.29"
  zone_id                        = data.aws_route53_zone.zone.zone_id
  namespace                      = "migration"
  domain_name                    = "sa.sandbox-aws.wandb.ml"
  subdomain                      = "sbx"
  public_access                  = true
  external_dns                   = true
  kubernetes_public_access       = true
  kubernetes_public_access_cidrs = ["0.0.0.0/0"]
  deletion_protection            = false
  use_internal_queue             = false
  create_elasticache             = true
}
data "aws_eks_cluster" "eks_cluster_id" {
  name = module.wandb_infra.cluster_id
}
data "aws_eks_cluster_auth" "eks_cluster_auth" {
  name = module.wandb_infra.cluster_id
}
provider "kubernetes" {
  host                   = data.aws_eks_cluster.eks_cluster_id.endpoint
  cluster_ca_certificate = base64decode(data.aws_eks_cluster.eks_cluster_id.certificate_authority.0.data)
  token                  = data.aws_eks_cluster_auth.eks_cluster_auth.token
}
provider "helm" {
  kubernetes {
    host                   = data.aws_eks_cluster.eks_cluster_id.endpoint
    cluster_ca_certificate = base64decode(data.aws_eks_cluster.eks_cluster_id.certificate_authority.0.data)
    token                  = data.aws_eks_cluster_auth.eks_cluster_auth.token
  }
}
output "url" {
  value = module.wandb_infra.url
}
output "bucket" {
  value = module.wandb_infra.bucket_name
}

Cycle dependencies observed during the plan.

$ terraform apply
‚ï∑
│ Error: Cycle: module.wandb_infra.module.wandb.helm_release.wandb, module.wandb_infra.module.wandb.var.wandb_namespace (expand), module.wandb_infra.module.wandb.var.spec (expand), module.wandb_infra.module.wandb.var.operator_chart_namespace (expand), module.wandb_infra.module.wandb.var.controller_image_tag (expand), module.wandb_infra.module.wandb.var.operator_chart_version (expand), module.wandb_infra.module.wandb.helm_release.operator, module.wandb_infra.module.wandb (expand), module.wandb_infra.module.wandb (close), module.wandb_infra.module.app_eks.aws_eks_addon.coredns, module.wandb_infra.module.app_eks.kubernetes_storage_class.gp3, module.wandb_infra.module.app_eks.aws_eks_addon.aws_efs_csi_driver, module.wandb_infra.module.app_eks.module.cluster_autoscaler.aws_iam_role_policy_attachment.default, module.wandb_infra.module.app_eks.module.cluster_autoscaler.aws_iam_policy.default, module.wandb_infra.module.app_eks.module.cluster_autoscaler.var.oidc_provider (expand), module.wandb_infra.module.app_eks.module.cluster_autoscaler.data.aws_iam_policy_document.default, module.wandb_infra.module.app_eks.module.cluster_autoscaler.aws_iam_role.default, module.wandb_infra.module.app_eks.module.cluster_autoscaler.data.aws_region.current, module.wandb_infra.module.app_eks.module.cluster_autoscaler.var.namespace (expand), module.wandb_infra.module.app_eks.module.cluster_autoscaler (expand), module.wandb_infra.module.app_eks.module.cluster_autoscaler.helm_release.cluster-autoscaler, module.wandb_infra.module.app_eks.module.cluster_autoscaler (close), module.wandb_infra.module.app_eks.kubernetes_annotations.gp2, module.wandb_infra.module.app_eks.aws_eks_addon.kube_proxy, module.wandb_infra.module.app_eks.module.lb_controller.var.aws_loadbalancer_controller_tags (expand), module.wandb_infra.module.app_eks.module.lb_controller.local.defaultTags (expand), module.wandb_infra.module.app_eks.module.lb_controller.aws_iam_policy.default, module.wandb_infra.module.app_eks.module.lb_controller.aws_iam_role_policy_attachment.default, module.wandb_infra.module.app_eks.module.lb_controller.helm_release.aws_load_balancer_controller, module.wandb_infra.module.app_eks.module.lb_controller.var.namespace (expand), module.wandb_infra.module.app_eks.module.lb_controller.var.oidc_provider (expand), module.wandb_infra.module.app_eks.module.lb_controller (expand), module.wandb_infra.module.app_eks.module.lb_controller.data.aws_iam_policy_document.default, module.wandb_infra.module.app_eks.module.lb_controller.aws_iam_role.default, module.wandb_infra.module.app_eks.module.lb_controller (close), module.wandb_infra.module.app_eks.aws_eks_addon.vpc_cni, module.wandb_infra.module.app_eks.aws_eks_addon.aws_ebs_csi_driver, module.wandb_infra.module.app_eks (close), data.aws_eks_cluster_auth.eks_cluster_auth, provider["registry.terraform.io/hashicorp/helm"], module.wandb_infra.module.app_eks.module.external_dns.helm_release.external_dns, module.wandb_infra.module.app_eks.module.external_dns.var.fqdn (expand), module.wandb_infra.module.app_eks.module.external_dns.data.aws_iam_policy_document.default, module.wandb_infra.module.app_eks.module.external_dns.aws_iam_role.default, module.wandb_infra.module.app_eks.module.external_dns.aws_iam_role_policy_attachment.default, module.wandb_infra.module.app_eks.module.external_dns.var.namespace (expand), module.wandb_infra.module.app_eks.module.external_dns.aws_iam_policy.default, module.wandb_infra.module.app_eks.module.eks.output.config_map_aws_auth (expand), module.wandb_infra.module.app_eks.module.eks (close), module.wandb_infra.module.app_eks.module.external_dns (expand), module.wandb_infra.module.app_eks.module.external_dns.var.oidc_provider (expand), module.wandb_infra.module.app_eks.module.external_dns (close), module.wandb_infra (close), data.aws_eks_cluster.eks_cluster_id, provider["registry.terraform.io/hashicorp/kubernetes"], module.wandb_infra.module.app_eks.module.eks.kubernetes_config_map.aws_auth

The same cycle dependencies were observed when upgrading from version 5.0.1 to 5.1

@flamarion flamarion added the Priority-P0 Critical priority designation label Nov 14, 2024
@amanpruthi
Copy link
Collaborator

Please use below correct output var in data block

data "aws_eks_cluster" "eks_cluster_id" {
  name = module.wandb_infra.cluster_id >>> module.wandb_infra.cluster_name
}
data "aws_eks_cluster_auth" "eks_cluster_auth" {
  name = module.wandb_infra.cluster_id >>> module.wandb_infra.cluster_name
}

@amanpruthi
Copy link
Collaborator

Please use below correct output var in data block

data "aws_eks_cluster" "eks_cluster_id" {
  name = module.wandb_infra.cluster_id >>> module.wandb_infra.cluster_name
}
data "aws_eks_cluster_auth" "eks_cluster_auth" {
  name = module.wandb_infra.cluster_id >>> module.wandb_infra.cluster_name
}

@flamarion
Copy link
Contributor Author

Let's make this a lower P until I can validate your instructions, @amanpruthi
Thank you for identifying my mistake on this.

@flamarion flamarion removed the Priority-P0 Critical priority designation label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants