Skip to content

feat(CENG-462): Add manage_entitlements_privilege to repository resource#196

Merged
cloudsmith-iduffy merged 3 commits intomasterfrom
ceng-462-add-support-for-manage-entitlements-repository-privilege-in
Apr 24, 2026
Merged

feat(CENG-462): Add manage_entitlements_privilege to repository resource#196
cloudsmith-iduffy merged 3 commits intomasterfrom
ceng-462-add-support-for-manage-entitlements-repository-privilege-in

Conversation

@cloudsmith-iduffy
Copy link
Copy Markdown
Contributor

Description

Add manage_entitlements_privilege field to the cloudsmith_repository resource and data source

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Tests
  • Other (please describe)

Testing

Acceptance tests were updated but I also tested manually with:

# tflint-ignore-file: terraform_required_version, terraform_required_providers

terraform {
  required_providers {
    cloudsmith = {
      source = "cloudsmith-io/cloudsmith"
    }
  }
}

provider "cloudsmith" {
  api_key = var.api_key
}

variable "api_key" {
  type = string
}

variable "namespace" {
  type        = string
  description = "Organization slug"
}

data "cloudsmith_organization" "org" {
  slug = var.namespace
}

# Create a private repository with entitlement privilege settings
resource "cloudsmith_repository" "repo" {
  description                  = "Repository with entitlement control example"
  name                         = "Entitlement Control Example"
  namespace                    = data.cloudsmith_organization.org.slug_perm
  slug                         = "entitlement-control-example"
  manage_entitlements_privilege = "Admin"
  use_entitlements_privilege   = "Read"
}

# Look up the Default entitlement token created with the repository
data "cloudsmith_entitlement_list" "defaults" {
  namespace  = resource.cloudsmith_repository.repo.namespace
  repository = resource.cloudsmith_repository.repo.slug_perm

  query = ["name:Default"]
}

# Disable the Default entitlement token
resource "cloudsmith_entitlement_control" "default_token" {
  namespace  = resource.cloudsmith_repository.repo.namespace
  repository = resource.cloudsmith_repository.repo.slug_perm
  identifier = data.cloudsmith_entitlement_list.defaults.entitlement_tokens[0].slug_perm
  enabled    = false
}

Additional Notes

Copilot AI review requested due to automatic review settings April 24, 2026 10:01
@cloudsmith-iduffy cloudsmith-iduffy requested review from a team as code owners April 24, 2026 10:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for configuring and reading manage_entitlements_privilege on Cloudsmith repositories, extending the provider’s repository resource and repository data source to expose Cloudsmith’s entitlement-token management privilege level.

Changes:

  • Added manage_entitlements_privilege to cloudsmith_repository schema and wired it through create/read/update.
  • Added manage_entitlements_privilege to cloudsmith_repository data source read + schema.
  • Updated repository resource/data source docs and updated the repository resource acceptance test.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/resources/repository.md Documents the new repository resource argument/attribute.
docs/data-sources/repository.md Documents the new repository data source attribute.
cloudsmith/resource_repository.go Adds schema + API mapping for manage_entitlements_privilege in CRUD.
cloudsmith/resource_repository_test.go Extends acceptance coverage for the repository resource to include the new field.
cloudsmith/data_source_repository.go Adds schema + read mapping for the new field on the repository data source.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cloudsmith/data_source_repository.go Outdated
Comment thread cloudsmith/data_source_repository.go
Comment thread docs/data-sources/repository.md Outdated
Comment thread cloudsmith/resource_repository_test.go Outdated
Comment thread docs/resources/repository.md Outdated
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the ceng-462-add-support-for-manage-entitlements-repository-privilege-in branch from 34faddc to e990cdc Compare April 24, 2026 10:06
cloudsmith-iduffy and others added 2 commits April 24, 2026 13:33
…rce and data source

Add the manage_entitlements_privilege attribute to the repository resource
(create, read, update) and data source (read), with validation, docs, and
acceptance tests for both.

Also cleans up doc formatting: backtick-wraps enum values, fixes trailing
whitespace, and removes stale go.sum entries from the API client upgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pre-install terraform via setup-terraform and set TF_ACC_TERRAFORM_PATH
so the plugin test framework reuses a single binary instead of copying
per test, eliminating the text file busy race condition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the ceng-462-add-support-for-manage-entitlements-repository-privilege-in branch 2 times, most recently from 019c1e9 to b0b0dca Compare April 24, 2026 12:55
@cloudsmith-iduffy cloudsmith-iduffy merged commit adf81b9 into master Apr 24, 2026
8 checks passed
@cloudsmith-iduffy cloudsmith-iduffy deleted the ceng-462-add-support-for-manage-entitlements-repository-privilege-in branch April 24, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants