No description
Find a file
Martin McCaffery 809e8aa192
Some checks failed
ci / Build and push (push) Failing after 17s
Update to SDK v2.3.1
2026-02-10 15:52:37 +01:00
.github/workflows Update to SDK v2.3.0 2026-02-10 15:41:31 +01:00
examples fix: added wait for the api to successful delete app or app instance 2026-01-19 15:27:57 +01:00
internal/provider Update to SDK v2.3.0 2026-02-10 15:41:31 +01:00
.gitignore init 2025-11-11 14:15:52 +01:00
.goreleaser.yaml improved .goreleaser.yaml 2025-11-18 15:46:54 +01:00
generate-provider-json.sh Move terralist to edp.buildth.ing 2026-01-29 16:36:29 +01:00
go.mod Update to SDK v2.3.1 2026-02-10 15:52:37 +01:00
go.sum Update to SDK v2.3.0 2026-02-10 15:41:31 +01:00
main.go fix: Fixed handling of removed resources when reading from client 2025-11-17 16:31:11 +01:00
Makefile init 2025-11-11 14:15:52 +01:00
README.md Move terralist to edp.buildth.ing 2026-01-29 16:36:29 +01:00
terraform-registry-manifest.json added terraform-registry-manifest.json 2025-11-18 14:04:36 +01:00

Terraform Provider for Edge Connect

This Terraform provider allows you to manage Edge Connect applications and application instances.

Features

  • Manage application specifications (edge-connect_app resource)
  • Manage application instances (edge-connect_appinst resource)
  • Query existing applications and instances (data sources)
  • Support for bearer token and basic authentication
  • Full CRUD operations for all resources

Requirements

  • Terraform >= 1.0
  • Go >= 1.21 (for development)
  • Access to an Edge Connect API endpoint

Installation

terraform {
  required_providers {
    edge-connect = {
      source  = "terralist.edp.buildth.ing/edge-connect/edge-connect"
      version = ">= 0.0.15"
    }
  }
}

Terralist

To allow the above downloads, the provider artifact must be published to a private Terraform registry. We use Terralist.

Terralist is deployed on EDP clusters via ArgoCD using the terralist stack. Administration can be performed by logging in via the relevant Forgejo instance (set up during cluster deployment), but no authentication is needed to download published Providers.

Publishing a new instance requires a GPG key, which is stored within the Forgejo Organisation secrets to be available to the release pipeline. It also requires a TERRALIST_API_KEY (stored at the repository level) to be able to push; this can be created within terralist settings: first create a new Authority with Name edge-connect and empty Policy, create a new API Key, then hit the ▽ button and 𓁹 to view the Key.

Next, you must ensure Terraform can download the Provider. To the Authority, add a Signing Key, with Key ID and ASCII Armor copied from the output of the release workflow. Trust Signature can be left empty.

Local Development

  1. Clone the repository:

    git clone ssh://git@edp.buildth.ing/DevFW-CICD/terraform-provider-edge-connect.git
    cd terraform-provider-edge-connect
    
  2. Generate the binary by running go install . from the repository root. This installs the provider binary to $HOME/go/bin and means that terraform init is not necessary. Note that you will need $HOME/go/bin to be in your $PATH variable for this to work smoothly.

  3. You will also need a ~/.terraformrc file with the following contents. <home> should refer to your $HOME directory. It should contain the following:

    provider_installation {
    
    dev_overrides {
        "local/edge-connect" = "<home>/go/bin"
    }
    
    # For all other providers, install them directly from their origin provider
    # registries as normal. If you omit this, Terraform will _only_ use
    # the dev_overrides block, and so no other providers will be available.
    direct {}
    }
    
  4. You can then test changes by running the following from the /examples/edgeconnect-config/ repo whenever you update the source code:

    go install ../../ && terraform plan
    
    • You will of course need credentials in order to execute terraform plan, as described below.

Usage

Provider Configuration

The provider must be configured with credentials and a URL. This can be done with a token in your code:

provider "edge-connect" {
  base_url = "https://edp.buildth.ing"
  token    = var.edge_connect_token
}

Or with basic authentication:

provider "edge-connect" {
  base_url = "https://edp.buildth.ing"
  username = var.edge_connect_username
  password = var.edge_connect_password
}

Or without code changes, via environment variables:

  • EDGE_CONNECT_BASE_URL
  • EDGE_CONNECT_TOKEN
  • EDGE_CONNECT_USERNAME
  • EDGE_CONNECT_PASSWORD

Creating an Application

resource "edge-connect_app" "example" {
  region       = "EU"
  organization = "myorg"
  name         = "my-app"
  version      = "1.0.0"

  image_type     = "Docker"
  image_path     = "nginx:latest"
  deployment     = "kubernetes"
  default_flavor = "EU.small"
  access_ports   = "tcp:80,tcp:443"
}

Creating an Application Instance

resource "edge-connect_appinst" "example" {
  region = "EU"

  app_organization      = edge-connect_app.example.organization
  app_name              = edge-connect_app.example.name
  app_version           = edge-connect_app.example.version
  cloudlet_organization = "cloudlet-org"
  cloudlet_name         = "edge-cloudlet-1"
  cluster_organization  = "cluster-org"

  flavor = "EU.medium"
}

Using Data Sources

data "edge-connect_app" "existing" {
  region       = "EU"
  organization = "myorg"
  name         = "existing-app"
  version      = "2.0.0"
}

output "app_image" {
  value = data.edge-connect_app.existing.image_path
}

Importing Existing Resources

Both resource types support Terraform's import command to bring existing resources under Terraform management.

Importing an Application

To import an existing application, use the following import ID format:

terraform import edge-connect_app.example organization/name/version/region/cloudlet_org/cloudlet_name/flavor_name

Example:

terraform import edge-connect_app.my_app edp2/my-app/1.0.0/EU/TelekomOP/Munich/EU.small

Note: The import ID requires all 7 fields because the Edge Connect API does not return cloudlet_org, cloudlet_name, or flavor_name when querying an app. These values must be provided in the import ID to satisfy Terraform's schema validation.

Make sure your Terraform configuration includes all required fields:

resource "edge-connect_app" "my_app" {
  name         = "my-app"
  app_version  = "1.0.0"
  organization = "edp2"
  region       = "EU"
  cloudlet_org  = "TelekomOP"
  cloudlet_name = "Munich"
  flavor_name   = "EU.small"

  # These will be populated from the API during import:
  # - manifest
  # - image_path
}

Importing an Application Instance

To import an existing application instance, use the following import ID format:

terraform import edge-connect_app_instance.example organization/name/cloudlet_org/cloudlet_name/region

Example:

terraform import edge-connect_app_instance.my_instance edp2/my-instance/TelekomOP/Munich/EU

All other required fields (app_name, app_version, app_organization, flavor_name, state, power_state) will be automatically populated from the API during the import.

Make sure your Terraform configuration includes the fields from the import ID:

resource "edge-connect_app_instance" "my_instance" {
  name             = "my-instance"
  organization     = "edp2"
  region           = "EU"
  cloudlet_org     = "TelekomOP"
  cloudlet_name    = "Munich"

  # These will be populated from the API during import:
  # - app_name
  # - app_version
  # - app_organization
  # - flavor_name
  # - state
  # - power_state
}

Resources

edge-connect_app

Manages an Edge Connect application specification.

Arguments

  • region (Required, Forces new resource) - The region where the app is deployed (e.g., 'EU')
  • organization (Required, Forces new resource) - The organization that owns the app
  • name (Required, Forces new resource) - The name of the application
  • version (Required, Forces new resource) - The version of the application
  • image_type (Required) - The type of image (e.g., 'Docker')
  • image_path (Required) - The path to the container image
  • deployment (Required) - The deployment type (e.g., 'kubernetes')
  • default_flavor (Optional) - The default flavor (e.g., 'EU.small', 'EU.medium', 'EU.big', 'EU.large')
  • deployment_manifest (Optional) - The Kubernetes deployment manifest (YAML)
  • access_ports (Optional) - The access ports in format 'protocol:port' (e.g., 'tcp:80,tcp:443')
  • annotations (Optional) - Annotations for the app

Attributes

  • id - The unique identifier (format: region/organization/name/version)
  • created_at - The timestamp when the app was created
  • updated_at - The timestamp when the app was last updated

edge-connect_appinst

Manages an Edge Connect application instance.

Arguments

  • region (Required, Forces new resource) - The region where the app instance is deployed
  • app_organization (Required, Forces new resource) - The organization that owns the app
  • app_name (Required, Forces new resource) - The name of the application
  • app_version (Required, Forces new resource) - The version of the application
  • cloudlet_organization (Required, Forces new resource) - The organization that owns the cloudlet
  • cloudlet_name (Required, Forces new resource) - The name of the cloudlet
  • cluster_organization (Required, Forces new resource) - The organization that owns the cluster
  • cloudlet (Optional) - The cloudlet identifier
  • flavor (Optional) - The flavor for the app instance

Attributes

  • id - The unique identifier
  • real_cluster_name - The real cluster name
  • state - The state of the app instance
  • runtime_info - Runtime information for the app instance
  • uri - The URI to access the app instance
  • liveness - The liveness status of the app instance
  • power_state - The power state of the app instance
  • created_at - The timestamp when the app instance was created
  • updated_at - The timestamp when the app instance was last updated

Data Sources

data.edge-connect_app

Fetches information about an existing Edge Connect application.

Arguments

  • region (Required) - The region where the app is deployed
  • organization (Required) - The organization that owns the app
  • name (Required) - The name of the application
  • version (Required) - The version of the application

data.edge-connect_appinst

Fetches information about an existing Edge Connect application instance.

Arguments

  • region (Required) - The region where the app instance is deployed
  • app_organization (Required) - The organization that owns the app
  • app_name (Required) - The name of the application
  • app_version (Required) - The version of the application
  • cloudlet_organization (Required) - The organization that owns the cloudlet
  • cloudlet_name (Required) - The name of the cloudlet
  • cluster_organization (Required) - The organization that owns the cluster

Examples

See the examples directory for complete usage examples.

Development

Building

go build -o terraform-provider-edge-connect

Testing

go test ./...

Running Example

cd examples
terraform init
terraform plan
terraform apply

Contributing

Contributions are welcome! Please submit pull requests or open issues on the repository.

License

This provider is distributed under the Mozilla Public License 2.0. See LICENSE for more information.

Support

For issues and questions: