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

"platform_reverse_proxy" always generates a diff #1141

Open
5 tasks done
jervi opened this issue Dec 3, 2024 · 2 comments
Open
5 tasks done

"platform_reverse_proxy" always generates a diff #1141

jervi opened this issue Dec 3, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jervi
Copy link

jervi commented Dec 3, 2024

Describe the bug
Using a minimal configuration for HTTP Docker reverse proxy settings, Terraform will always create a diff on every plan, even when there are no changes.

Artifactory version: 7.98.9 rev 79809900 (self hosted)
Terraform version: 1.9.7
Terraform provider version: 1.18.2

Given this terraform config:

resource "platform_reverse_proxy" "containers" {
  docker_reverse_proxy_method = "SUBDOMAIN"
  server_provider             = "DIRECT"
}

On every plan after the first apply, Terraform will generate the following diff:

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
! update in-place

Terraform will perform the following actions:

  # module.artifactory.platform_reverse_proxy.containers will be updated in-place
! resource "platform_reverse_proxy" "containers" {
!       http_port                   = -1 -> 80
-       internal_hostname           = "artifacts.my-artifactory-domain.io" -> null
-       public_server_name          = "artifacts.my-artifactory-domain.io" -> null
!       use_https                   = true -> false
        # (3 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

The four settings are not required when using the embedded Tomcat reverse proxy, and as can be seen in the UI, they are not possible to change at all.
If I try to set them to what Terraform expect, just to get rid of the diff, it works for three of the config options, but the use_https option has some validation built in that makes it impossible to set without adding SSL settings as well (which are completely unnecessary).

Example:

resource "platform_reverse_proxy" "containers" {
  docker_reverse_proxy_method = "SUBDOMAIN"
  server_provider             = "DIRECT"
  http_port                   = -1
  use_https                   = true
  internal_hostname           = var.artifactory_url
  public_server_name          = var.artifactory_url
}

Results in:

Error: Missing Attribute Configuration
ssl_key_path must be configured when use_https is set to 'true'.
ssl_certificate_path must be configured when use_https is set to 'true'.

And if I set use_https to false, I'm back to getting a diff on every plan/apply.

Requirements for and issue

  • A description of the bug
  • A fully functioning terraform snippet that can be copy&pasted (no outside files or ENV vars unless that's part of the issue). If this is not supplied, this issue will likely be closed without any effort expended.
  • Your version of artifactory (you can curl it at $host/artifactory/api/system/version
  • Your version of terraform
  • Your version of terraform provider

Expected behavior
There should be no diff when running the plan/apply a second time.

@jervi jervi added the bug Something isn't working label Dec 3, 2024
@alexhung
Copy link
Member

alexhung commented Dec 3, 2024

@jervi Thanks for the report! I've added this to our plan to investigate and fix.

@alexhung
Copy link
Member

alexhung commented Dec 3, 2024

@jervi Have you tried this configuration?

resource "platform_reverse_proxy" "containers" {
  docker_reverse_proxy_method = "SUBDOMAIN"
  server_provider             = "DIRECT"
  http_port                   = 80
  internal_hostname           = "artifacts.my-artifactory-domain.io"
  public_server_name          = "artifacts.my-artifactory-domain.io"
}

(or use var.artifactory_url if it resolves to same value)

This should eliminate the state drift for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants