Skip to content

feat(container-registry): onboard tf driver for container registry - #1870

Open
martinezmo wants to merge 5 commits into
stackitcloud:mainfrom
martinezmo:feat/container-registry
Open

martinezmo wants to merge 5 commits into
stackitcloud:mainfrom
martinezmo:feat/container-registry

Conversation

@martinezmo

Copy link
Copy Markdown

Description

relates to STACKITCRE-383

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@martinezmo
martinezmo requested a review from a team as a code owner November 6, 2026 21:43

@Fyusel Fyusel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for your contribution.
Only some small things at the start, will continue with a detailed review

"credentials": types.ObjectType{AttrTypes: credentialsTypes},
}

var descriptions = map[string]string{ //nolint:gosec // linter false positive

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please describe what the false positive is


type proxyItemModel struct {
Description types.String `tfsdk:"description"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please remove empty lines

var proxyTypes = map[string]attr.Type{

"description": types.StringType,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please remove empty lines

}

var artifactoryItemTypes = map[string]attr.Type{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here and the following as well please

}

resp.Diagnostics.Append(req.Config.Get(ctx, &configModel)...)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please remove empty lines

@@ -0,0 +1,36 @@
variable "project_id" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please use the same structure as in the other services

@@ -0,0 +1,12 @@
variable "project_id" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here

ImportState: true,
ImportStateVerify: true,
},
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Update missing

dockerUsername := os.Getenv("TF_ACC_CONTAINER_REGISTRY_DOCKER_USERNAME")
dockerPassword := os.Getenv("TF_ACC_CONTAINER_REGISTRY_DOCKER_PASSWORD")
if dockerUsername == "" || dockerPassword == "" {
t.Skip("Skipping TestAccContainerRegistryArtifactoryMax: TF_ACC_CONTAINER_REGISTRY_DOCKER_USERNAME or TF_ACC_CONTAINER_REGISTRY_DOCKER_PASSWORD not set")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this mean the max test can only run with a valid docker username an password?
So in order to test this ressource a docker account is needed?

Is there a possibility to run a max test without such external dependencies? We cannot provide a docker account in order to run this acceptance test (currently we run those locally but in the future this will be done by the CI).

service_account_email = "abc@abc.de"
cdn_custom_endpoint = "https://cdn.api.eu01.stackit.cloud"
dns_custom_endpoint = "https://dns.api.stackit.cloud"
containerregistry_custom_endpoint = "https://registry.api.stackit.cloud"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mismatch: container_registry_custom_endpoint

"region": schema.StringAttribute{
Description: descriptions["region"],
Optional: true,
Computed: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Computed: true,

Description: descriptions["artifactory_id"],
Required: true,
Validators: []validator.String{
validate.NoSeparator(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

validate.UUID(), missing

fmt.Sprintf("Calling API: %v", err),
map[int]string{
http.StatusNotFound: fmt.Sprintf("Artifactory %q not found", artifactoryId),
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

resp.State.RemoveResource(ctx) missing

Description: descriptions["artifactory_id"],
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Validators: []validator.String{
validate.UUID(),
validate.NoSeparator(),
},

Description: descriptions["create_time"],
Computed: true,
},
"state": schema.StringAttribute{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove state please


payload := registry.NewPatchArtifactoryPayload()

if !model.Proxy.IsNull() && !model.Proxy.IsUnknown() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

e.g. here

}
}

secret := getAccessSecret(&creds, nil, configCreds, false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

regarding credentials and the write only attribute: please have a look at e.g. the VPN resource and use the same implementation like it is there

if !resp.Diagnostics.HasError() {
t.Error("expected diagnostics on delete error")
}
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TestSavesIDsOnError is missing (see CONTRIBUTION for more details)

"registry_type": types.StringType,
}

var descriptions = map[string]string{ //nolint:gosec // linter false positive

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here: more details why false positive

"region": schema.StringAttribute{
Description: descriptions["region"],
Optional: true,
Computed: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Computed: true,

This branch has not been deployed

No deployments
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.

2 participants