terraform-coop / terraform-provider-foreman

Terraform provider for Foreman
https://registry.terraform.io/providers/terraform-coop/foreman
Mozilla Public License 2.0
33 stars 31 forks source link

foreman_katello_repository resource update is not possible #161

Open togoschi opened 1 month ago

togoschi commented 1 month ago

If you apply a parameter update of an existing foreman_katello_repository resource it fails with

╷
│ Error: HTTP Error:{
│   endpoint:   [https://orcharhino.lcm-dev.hanse-merkur.de/katello/api/repositories/42]
│   statusCode: [500]
│   respBody:   [{"displayMessage":"invalid value for \"download_concurrency\", must be greater than or equal to 1.","errors":["invalid value for \"download_concurrency\", must be greater than or equal to 1."]}]
│ }
│ 
│   with foreman_katello_repository.ubuntu_jammy,
│   on ubuntu.tf line 10, in resource "foreman_katello_repository" "ubuntu_jammy":
│   10: resource "foreman_katello_repository" "ubuntu_jammy" {
│ 

It doesn't matter which parameter needs an update, it always fails with the same error message. Also all attempts to fix the problem with different values of "download_concurrency" were unsuccessful (it seems that the attribut is ignored at all).

Terraform code example

resource "foreman_katello_repository" "ubuntu_jammy" {
  name = "Ubuntu Jammy"
  description = "Ubuntu 22.04"
  url = "http://de.archive.ubuntu.com/ubuntu"
  verify_ssl_on_sync = true
  content_type = "deb"
  deb_architectures = "amd64"
  deb_releases = "jammy"
  deb_components = "main restricted universe multiverse"
  download_policy = "on_demand"
  ### download_concurrency = 1
  mirroring_policy = "mirror_content_only"
  unprotected = true
  product_id = foreman_katello_product.ubuntu_jammy.id
  gpg_key_id = data.foreman_katello_content_credential.ubuntu.id
  http_proxy_id = data.foreman_httpproxy.default.id
  http_proxy_policy = "use_selected_http_proxy"
}
vhsantos commented 2 weeks ago

here with the same issue, maybe because download_concurrency aren't enable anymore ?

bitkeks commented 1 week ago

According to https://github.com/Katello/katello/blob/a4b8414151959d5af79c6904455647011025ead9/app/controllers/katello/api/v2/repositories_controller.rb#L57 the download_concurrency parameter should be available in Katello 4.9 - which is used in this case.

There's currently a (DiffSuppressFunc)[https://github.com/terraform-coop/terraform-provider-foreman/blame/27ca840eef52bcf8355fa458ac6d5325e8c04b16/foreman/resource_foreman_katello_repositories.go#L168] applied to download_concurrency in Terraform manifests. May be it causes a problem that came up since then. I'll have to debug it with the example code.