Skip to content

provider: add provider-level default_labels and apply them across label-capable resources#557

Draft
pierre-emmanuelJ with Copilot wants to merge 2 commits into
masterfrom
copilot/feature-default-labels-provider-level
Draft

provider: add provider-level default_labels and apply them across label-capable resources#557
pierre-emmanuelJ with Copilot wants to merge 2 commits into
masterfrom
copilot/feature-default-labels-provider-level

Conversation

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown

Description

Adds provider-level default_labels so a workspace can define shared labels once and have them applied to resources that support labels. Resource-local labels still take precedence on key conflicts.

  • Provider schema + config plumbing

    • Added default_labels to both provider implementations (exoscale SDKv2 and framework provider).
    • Propagated defaults through provider config objects for downstream resource access.
  • Label merge/strip behavior

    • Added reusable helpers to:
      • convert Terraform maps to map[string]string
      • merge provider defaults with resource labels (resource values win)
      • strip defaults from state reads to avoid persistent diffs when labels are inherited only from provider config.
  • Applied to label-capable resources

    • Wired merge-on-create/update and strip-on-read in resources currently handling labels across SDKv2/framework code paths (including compute, instance pool, SKS, NLB/private network/elastic IP, block storage, IAM role).
  • Docs + focused tests

    • Updated provider docs/template to expose default_labels.
    • Added focused tests for provider schema exposure and label helper behavior.
provider "exoscale" {
  key    = var.exoscale_api_key
  secret = var.exoscale_api_secret

  default_labels = {
    tf_repo      = "https://example.org/my-iac-repo/paf"
    tf_workspace = terraform.workspace
  }
}

resource "exoscale_nlb" "example" {
  # ...
  labels = {
    tf_workspace = "override-for-this-resource"
  }
}

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block)
  • Acceptance tests OK
  • For a new resource, datasource or new attributes: acceptance test added/updated

Testing

Targeted unit/package test coverage was added for schema/helper behavior; full acceptance coverage is left to CI/maintainer validation.

Copilot AI changed the title [WIP] Add default_labels at provider level to tag all resources provider: add provider-level default_labels and apply them across label-capable resources Jun 17, 2026
Copilot AI requested a review from pierre-emmanuelJ June 17, 2026 07:47
@pierre-emmanuelJ
pierre-emmanuelJ requested a review from a team June 18, 2026 16:26
@pierre-emmanuelJ
pierre-emmanuelJ marked this pull request as ready for review June 18, 2026 16:27
@pierre-emmanuelJ
pierre-emmanuelJ marked this pull request as draft June 18, 2026 16:33
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.

[Feature Request]: default_labels at provider level to tag all ressources that support it

2 participants