# TOML / INI / HCL / .env / Nix / dotenv ⇄ Kubernetes ConfigMap & Secret Config Format Bridge

Convert configuration files between dotenv .env, TOML, INI, Java .properties, YAML, JSON, HCL (Terraform/Vagrant native syntax) and Nix attribute sets, and emit Kubernetes ConfigMap or Secret manifests. Template placeholders (${VAR}, {{var}}, envsubst) are preserved verbatim, type inference provenance (string/int/float/bool/list) is tracked, HCL block labels fold into nested keys, and a round-trip diff calls out non-equivalent settings — dropped keys, re-typed values and rewrites — instead of coercing them silently.

> Canonical page: https://elysiatools.com/en/tools/toml-ini-hcl-envfile-nix-dotenv-kubernetes-configmap-secret-config-format-bridge

- **Category:** Format Conversion

- **Keywords:** config converter, dotenv, TOML, INI, HCL, Terraform, Nix, Kubernetes ConfigMap, Kubernetes Secret, properties, YAML, envsubst

## Overview

Every format parses into a typed intermediate tree: scalar types (string/int/float/bool/null), lists, nested objects, HCL block labels and interpolation placeholders all keep their provenance. dotenv values are always strings (their real semantics); bare INI/.properties values are inferred as int/float/bool and flagged as inferred, while quoted values stay strings; HCL expressions (functions, references) are kept verbatim with a note; the Nix reader supports let … in, inherit, dotted attribute paths and ''…'' indented strings, marking lambdas and unresolved references instead of failing. ConfigMap/Secret manifests use stringData (the server merges it; Kubernetes applies the base64 encoding for Secrets) and keys are sanitized to the K8s charset (alphanumeric, '-', '_', '.'). The round-trip diff re-parses the emitted output and compares it key by key with the source tree, reporting dropped/added/type/value classes — exactly the list a human should review during a cross-format migration. TOML and YAML parsing use the battle-tested @iarna/toml and js-yaml libraries; the dotenv/INI/properties/HCL/Nix sides are bounded subsets with line-precise errors.

## Inputs

- **Configuration source (paste one file)** (textarea): DATABASE_HOST=localhost DATABASE_PORT=5432 …
- **Source format** (select)
- **Target format** (select)
- **Manifest name (for Kubernetes targets)** (text): my-app-config
- **Run round-trip diff** (checkbox)

## When to use

- Migrating local development .env files or application configs directly into Kubernetes ConfigMap or Secret manifests.
- Converting complex infrastructure declarations between Terraform HCL, Nix attribute sets, TOML, and JSON without losing nested block structures.
- Auditing configuration transformations with round-trip diffing to catch dropped keys, re-typed values, or silent coercions.

## How it works

- Paste your configuration snippet into the source area and choose an explicit parser or let the tool auto-detect the format.
- Select your target configuration format, including structured formats like TOML/YAML/Nix or Kubernetes ConfigMap/Secret manifests.
- Specify optional settings such as a Kubernetes manifest name and enable the round-trip diff check.
- Review the converted output alongside a key-by-key round-trip audit report highlighting preserved types and template interpolations.

## Use cases

- Containerizing microservices by turning local .env variable lists into deployment-ready Kubernetes ConfigMap and Secret manifests.
- Translating Terraform HCL variable blocks and resource attributes into declarative Nix attribute sets or structured JSON.
- Refactoring legacy Java .properties or INI configurations into modern TOML and YAML files for unified application settings.

## Frequently asked questions

### How does the converter handle template placeholders like ${VAR} or {{var}}?

Template placeholders, envsubst syntax, and variable interpolation expressions are preserved verbatim without accidental evaluation or stripping.

### How are Kubernetes ConfigMap and Secret manifests generated?

The tool emits manifests using stringData with sanitized Kubernetes-compliant key names, allowing plain text values that Kubernetes handles and encodes.

### How does type inference work across formats like INI and .env?

Dotenv values remain strings by design, while bare INI and .properties values are inferred as numbers or booleans and marked as inferred.

### What happens to nested HCL block labels during conversion?

HCL block labels fold into nested key paths (such as resource.aws_instance.web) to preserve structure in formats like JSON, YAML, or Nix.

### What does the round-trip diff check?

It re-parses the generated output and compares it against the intermediate source tree, reporting dropped keys, added fields, and value or type changes.

## Related tools

- [YAML-JSON Converter](https://elysiatools.com/en/tools/yaml-json-converter): Convert between YAML and JSON formats
- [WireGuard/OpenVPN to Clash and sing-box Config Bridge](https://elysiatools.com/en/tools/wireguard-openvpn-to-clash-singbox-bridge): Convert pasted WireGuard or OpenVPN client text into Mihomo/Clash YAML or sing-box JSON with secret-field diagnostics; do not share private keys
- [JSONata Query & Transform Studio](https://elysiatools.com/en/tools/jsonata-query-transform-studio): Preview JSONata-style queries and transformations, compare results across sample payloads, and export the transformed output as JSON, CSV, YAML, or Markdown
- [HCL-JSON Converter](https://elysiatools.com/en/tools/hcl-json-converter): Convert between HashiCorp Configuration Language (HCL) and JSON formats for Terraform configurations
- [Text to Excel Converter](https://elysiatools.com/en/tools/text-to-excel): Convert various text formats to Excel with customizable parsing and formatting options
- [Text to JSON Converter](https://elysiatools.com/en/tools/text-to-json): Convert various text formats to JSON with customizable parsing options
- [TOML-JSON Converter](https://elysiatools.com/en/tools/toml-json-converter): Convert between TOML and JSON formats with support for comments and complex data structures
- [Config File Semantic Diff](https://elysiatools.com/en/tools/config-file-semantic-diff): Compare JSON, YAML, TOML, and dotenv configurations by key path while ignoring ordering and formatting noise.

## Samples

- [Kubernetes YAML Samples](https://elysiatools.com/en/samples/kubernetes-yaml): Complete Kubernetes YAML manifests for Deployment, Service, ConfigMap, Secret, Ingress and other essential resources
- [Distributed Tracing Samples](https://elysiatools.com/en/samples/distributed-tracing-samples): Comprehensive distributed tracing examples using Jaeger, OpenTelemetry, and other modern observability tools for microservices architecture
- [Docker & Kubernetes Samples](https://elysiatools.com/en/samples/docker-kubernetes): Essential container orchestration examples including Dockerfiles, Docker Compose, and Kubernetes manifests for modern application deployment
- [OpenAPI/Swagger Samples](https://elysiatools.com/en/samples/openapi-swagger): Comprehensive API documentation examples using OpenAPI 3.0 and Swagger specifications for RESTful services
