Skip to content

[Bug]: flux provider not inheriting correctly ssh section when flux provider is passed via module #714

@dempo93

Description

@dempo93

Describe the bug

I am using the flux provider by initializing it with the output of a module

provider "flux" {
  kubernetes = {
    host                   = data.aws_eks_cluster.cluster.endpoint
    cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority[0].data)
    token                  = data.aws_eks_cluster_auth.cluster.token
  }
  git = {
    url    = module.setup.ssh_url_to_repo
    branch = module.setup.default_branch
    ssh = {
      username    = module.setup.gitlab_ssh_username
      private_key = module.setup.gitlab_ssh_private_key
    }
  }
}

but this results in

╷
│ Error: Git Client
│ 
│ could not create git client: ssh scheme cannot be used without private key
╵

My problem, and my code, is a duplicate of #531. I tested it on the latest version (1.3.0 at the time of writing)

Steps to reproduce

Follow the reproduction steps on #531

Expected behavior

flux_bootstrap_git does not error out and gets correctly initialized with the module output

Screenshots and recordings

No response

Terraform and provider versions

Terraform v1.8.3
on linux_amd64
+ provider registry.terraform.io/fluxcd/flux v1.3.0

Terraform provider configurations

provider "flux" {
  kubernetes = {
    host                   = data.aws_eks_cluster.cluster.endpoint
    cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority[0].data)
    token                  = data.aws_eks_cluster_auth.cluster.token
  }
  git = {
    url    = module.setup.ssh_url_to_repo
    branch = module.setup.default_branch
    ssh = {
      username    = module.setup.gitlab_ssh_username
      private_key = module.setup.gitlab_ssh_private_key
    }
  }
}

flux_bootstrap_git resource

resource "flux_bootstrap_git" "this" {
  namespace        = var.namespace
  components_extra = ["image-reflector-controller", "image-automation-controller"]
}

Flux version

v2.3.0 (default)

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions