Repository navigation
feat(container-registry): onboard tf driver for container registry - #1870
martinezmo wants to merge 6 commits into
Conversation
Fyusel
left a comment
There was a problem hiding this comment.
Thank you for your contribution.
Only some small things at the start, will continue with a detailed review
| 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" |
There was a problem hiding this comment.
mismatch: container_registry_custom_endpoint
| "region": schema.StringAttribute{ | ||
| Description: descriptions["region"], | ||
| Optional: true, | ||
| Computed: true, |
There was a problem hiding this comment.
| Computed: true, |
| Description: descriptions["artifactory_id"], | ||
| Required: true, | ||
| Validators: []validator.String{ | ||
| validate.NoSeparator(), |
| fmt.Sprintf("Calling API: %v", err), | ||
| map[int]string{ | ||
| http.StatusNotFound: fmt.Sprintf("Artifactory %q not found", artifactoryId), | ||
| }, |
There was a problem hiding this comment.
resp.State.RemoveResource(ctx) missing
| Description: descriptions["artifactory_id"], | ||
| Computed: true, | ||
| PlanModifiers: []planmodifier.String{ | ||
| stringplanmodifier.UseStateForUnknown(), |
There was a problem hiding this comment.
Validators: []validator.String{
validate.UUID(),
validate.NoSeparator(),
},
| Description: descriptions["create_time"], | ||
| Computed: true, | ||
| }, | ||
| "state": schema.StringAttribute{ |
|
|
||
| payload := registry.NewPatchArtifactoryPayload() | ||
|
|
||
| if !model.Proxy.IsNull() && !model.Proxy.IsUnknown() { |
| } | ||
| } | ||
|
|
||
| secret := getAccessSecret(&creds, nil, configCreds, false) |
There was a problem hiding this comment.
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") | ||
| } | ||
| }) |
There was a problem hiding this comment.
TestSavesIDsOnError is missing (see CONTRIBUTION for more details)
| "registry_type": types.StringType, | ||
| } | ||
|
|
||
| var descriptions = map[string]string{ //nolint:gosec // linter false positive |
There was a problem hiding this comment.
same here: more details why false positive
| "region": schema.StringAttribute{ | ||
| Description: descriptions["region"], | ||
| Optional: true, | ||
| Computed: true, |
There was a problem hiding this comment.
| Computed: true, |
| Description: descriptions["create_time"], | ||
| Computed: true, | ||
| }, | ||
| "state": schema.StringAttribute{ |
| Optional: true, | ||
| Computed: true, | ||
| }, | ||
| "artifactories": schema.ListNestedAttribute{ |
There was a problem hiding this comment.
There is an ADR on our side (https://developers.stackit.schwarz/domains/customer-touchpoints/developer-tools/adr/terraform-datasource-filtering/) this needs to be called results
| Optional: true, | ||
| Computed: true, | ||
| }, | ||
| "replication_adapters": schema.ListNestedAttribute{ |
There was a problem hiding this comment.
see artifactories -> needs to be called results
|
|
||
| data "stackit_containerregistry_artifactories" "this" { | ||
| project_id = local.project_id | ||
| } |
There was a problem hiding this comment.
Regarding the ADR: filter examples should be added here as well
|
|
||
| data "stackit_containerregistry_replication_adapters" "this" { | ||
| project_id = local.project_id | ||
| } |
There was a problem hiding this comment.
Regarding the ADR: filter examples should be added here as well
|
|
||
| "create_time": types.StringType, | ||
|
|
||
| "state": types.StringType, |
There was a problem hiding this comment.
of course all other occurrences of state needs to be removed as well
| ctx = tflog.SetField(ctx, "project_id", projectId) | ||
| ctx = tflog.SetField(ctx, "region", region) | ||
|
|
||
| listResp, err := d.client.ListReplicationAdapters(ctx, projectId, region).Execute() |
There was a problem hiding this comment.
The API offers a next_page_token as well here, this is missing
|
|
||
| allArtifactories = append(allArtifactories, listResp.Artifactories...) | ||
|
|
||
| if listResp.NextPageToken == nil || *listResp.NextPageToken == "" { |
There was a problem hiding this comment.
regarding the pagination please use the paginate.All() functionality. There are also examples in the SDK (experimental/paginate). Same for replicationadapters
Description
relates to STACKITCRE-383
Checklist
make fmtexamples/directory)make generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)