Skip to content

CLI app export is hardcoded to check for .tofurc overrides only #21

Description

@danielodievich

When running with local .terraformrc override http://developer.hashicorp.com/terraform/cli/config/config-file and trying to run ei apps export, the override does not get picked up

It is because https://github.com/elementumltd/elementum-cli/blob/main/export/terraform.go#L120-L133 is hardcoded to check only for .tofurc https://opentofu.org/docs/cli/config/config-file/

	tofurcPath := filepath.Join(os.Getenv("HOME"), ".tofurc")
	if _, err := os.Stat(tofurcPath); err == nil {
		// .tofurc exists, check if it contains dev_overrides for elementum
		content, err := os.ReadFile(tofurcPath)
		if err == nil && containsString(string(content), "elementumltd/elementum") {
			// Dev overrides are likely active - skip init as it will fail
			// The provider binary will be found via dev_overrides
			// Remove any existing .terraform directory and lock file that might conflict
			_ = os.RemoveAll(filepath.Join(tr.WorkDir, ".terraform"))
			_ = os.Remove(filepath.Join(tr.WorkDir, ".terraform.lock.hcl"))
			fmt.Println("✓ Using provider dev_overrides (skipping init)")
			return nil
		}
	}

This needs to check for either of those two files

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions