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

[Bug]: Embedded manifests fails on Windows when TMP folder is on a different drive to local #703

Open
1 task done
ianwalkeruk opened this issue Aug 2, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ianwalkeruk
Copy link

Describe the bug

Attempting to create a new bootstrap resource following e.g. examples/github-via-ssh, on Windows (11) where my TF files are on a different drive (V:) to my TMP folder (C:), fails with an error

Steps to reproduce

On a Windows system with more than one drive configured:

  1. Determine the location of the default temp directory, e.g. $env:TMP in PowerShell
  2. Create a new folder on a different drive to the temp directory, and copy the github-via-ssh example in there, and configure the variables
  3. Run terraform/tofu apply

Observe the error, e.g.:

flux_bootstrap_git.this: Creating...
╷
│ Error: Bootstrap run error
│
│   with flux_bootstrap_git.this,
│   on main.tf line 63, in resource "flux_bootstrap_git" "this":
│   63: resource "flux_bootstrap_git" "this" {
│
│ component manifest generation failed: Rel: can't make C:\Users\XXXX\AppData\Local\Temp\flux-manifests-1341206813
│ relative to V:\MyProject\tofu

Expected behavior

For the flux_bootstrap_git resource to be created successfully

Screenshots and recordings

No response

Terraform and provider versions

OpenTofu v1.8.0
on windows_amd64
+ provider registry.opentofu.org/fluxcd/flux v1.3.0
+ provider registry.opentofu.org/hashicorp/tls v4.0.5
+ provider registry.opentofu.org/integrations/github v6.2.3
+ provider registry.opentofu.org/tehcyx/kind v0.5.1

Terraform provider configurations

provider "flux" {
kubernetes = {
host = kind_cluster.this.endpoint
client_certificate = kind_cluster.this.client_certificate
client_key = kind_cluster.this.client_key
cluster_ca_certificate = kind_cluster.this.cluster_ca_certificate
}
git = {
url = "https://github.com/${var.github_org}/${var.github_repository}.git"
http = {
username = "git" # This can be any string when using a personal access token
password = var.github_token
}
}
}

provider "github" {
owner = var.github_org
token = var.github_token
}

provider "kind" {}

flux_bootstrap_git resource

resource "flux_bootstrap_git" "this" {
depends_on = [github_repository_deploy_key.this]

embedded_manifests = true
path = "clusters/my-cluster"
}

Flux version

v2.3.0

Additional context

I think the source of the problem is that in:

tmpDir, err := manifestgen.MkdirTempAbs("", "flux-bootstrap-")

passing "" as the first parameter ultimately causes Go to use the os.TempDir function (https://pkg.go.dev/os#TempDir)

A workaround is to set TMP to a folder on the same drive as the project, e.g. $env:TMP = 'V:\Temp' - this causes the apply command to complete successfully.

Code of Conduct

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

Would you like to implement a fix?

None

@swade1987 swade1987 self-assigned this Aug 2, 2024
@swade1987 swade1987 added the bug Something isn't working label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants