Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a platform_custom_base_url resource. #175

Open
goodtune opened this issue Dec 10, 2024 · 1 comment
Open

Add a platform_custom_base_url resource. #175

goodtune opened this issue Dec 10, 2024 · 1 comment
Assignees
Labels
feature request New feature or request no API support Lack REST API to support in Terraform provider

Comments

@goodtune
Copy link

Is your feature request related to a problem? Please describe.

Yes, I've just created a artifactory_remote_cargo_repository repository on our Edge node, only for it to fail during the apply step (plan was fine) with the following error:

│ Error: {
│   "errors" : [ {
│     "status" : 400,
│     "message" : "Custom Base URL should be defined prior to creating a Cargo repository"
│   } ]
│ }

Our Edge nodes are completely configured using Terraform providers, so it would be ideal to be able to declare this as a resource too.

Describe the solution you'd like

Make use of the Update Custom URL Base API.

resource "platform_custom_base_url" "this" {
    custom_base_url = "https://mycompany.com:444"
}

resource "artifactory_remote_cargo_repository" "crates" {
    ...
    depends_on = [
        platform_custom_base_url.this
    ]
}

Describe alternatives you've considered

I wanted to use the http provider, however it won't permit the PUT method.

data "http" "custom-base-url" {
  url    = "https://${var.name}/artifactory/api/system/configuration/baseUrl"
  method = "PUT"
  request_headers = {
    "Authorization" = "Bearer ${var.token}"
    "Content-Type"  = "text/plain"
  }
  request_body = "https://mycompany.com:444"
}

In the immediate term I guess I will either do it manually 🤮 or wrap a cURL step to do it.

Additional context

https://registry.terraform.io/providers/jfrog/artifactory/latest/docs/resources/remote_cargo_repository#note

@alexhung alexhung added feature request New feature or request no API support Lack REST API to support in Terraform provider labels Dec 10, 2024
@alexhung
Copy link
Member

@goodtune Thanks for the suggestion. Unfortunately, currently Artifactory lacks a full set of REST API for custom base URL for support in Terraform. We are aware of this gap and are planning to fill it in the future.

In the meantime, the alternative you suggest using a HTTP provider is sound. There are other non-HashiCorp providers that support PUT method (e.g. https://registry.terraform.io/providers/salrashid123/http-full/latest).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request no API support Lack REST API to support in Terraform provider
Projects
None yet
Development

No branches or pull requests

2 participants