Skip to content

Conversation

@daniel-edgedelta
Copy link

Summary

This PR adds support for creating Kubernetes configurations through the Terraform provider by including the required environment, fleet_type, and fleet_subtype fields in API requests.

Problem

Previously, attempting to create EdgeDelta configs for Kubernetes environments would fail with:

Error: Could not create the config resource
got non OK http status from: POST /v1/orgs/{org_id}/confs, status: 400, 
response: {"Error":"Failed to validate config create request, err: environment is required"}

Solution

  • Added environment, fleet_type, and fleet_subtype fields to the Config struct
  • Exposed these as optional Terraform resource parameters with sensible defaults
  • Auto-sets fleet_subtype to "Edge" when environment is "Kubernetes" (required by API)
  • Extracts the tag from YAML content for proper API request formation

Testing

Tested locally by:

  1. Building the provider locally
  2. Creating a Kubernetes config successfully
  3. Verifying via API that all fields were set correctly

Example Usage

resource "edgedelta_config" "kubernetes" {
  environment    = "Kubernetes"
  fleet_type     = "Edge"
  fleet_subtype  = "Edge"
  config_content = file("config.yaml")
}

Backward Compatibility

Fully backward compatible - all new fields are optional with defaults:

  • environment: defaults to "Linux"
  • fleet_type: defaults to "Edge"
  • fleet_subtype: defaults to empty (auto-set for Kubernetes)

This commit adds the required environment, fleet_type, and fleet_subtype
fields to the edgedelta_config resource, enabling proper creation of
Kubernetes configurations through the Terraform provider.

Changes:
- Added environment, fleet_type, and fleet_subtype fields to Config struct
- Added these fields as optional parameters in the resource schema
- Set appropriate defaults (Linux for environment, Edge for fleet_type)
- Auto-set fleet_subtype to Edge when environment is Kubernetes
- Extract tag from YAML content for API requirements

Fixes the issue where creating Kubernetes configs would fail with
'environment is required' error from the EdgeDelta API.
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

Successfully merging this pull request may close these issues.

1 participant