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.public_server_name cannot be parametrized #186

Closed
piotrminkina opened this issue Dec 24, 2024 · 4 comments · Fixed by #188
Closed

platform_reverse_proxy.public_server_name cannot be parametrized #186

piotrminkina opened this issue Dec 24, 2024 · 4 comments · Fixed by #188
Assignees
Labels
bug Something isn't working

Comments

@piotrminkina
Copy link

Describe the bug
Consider the following hcl code:

variable "artifactory_public_server_name" {
  type     = string
  default  = "localhost"
  nullable = false
}

resource "platform_reverse_proxy" "reverse_proxy" {
  public_server_name          = var.artifactory_public_server_name
  internal_hostname           = "artifactory"
  server_provider             = "NGINX"
  docker_reverse_proxy_method = "SUBDOMAIN"
  use_https                   = true
  ssl_certificate_path        = "path/to/file.crt"
  ssl_key_path                = "path/to/file.key"
}

It seems that probably due to some bug this property cannot be parameterized. Executing the terraform plan command on this example ends with an error.

│ Error: Missing Attribute Configuration
│ 
│   with platform_reverse_proxy.reverse_proxy,
│   on reverse_proxy.tf line 2, in resource "platform_reverse_proxy" "reverse_proxy":
│    2:   public_server_name          = var.artifactory_public_server_name
│ 
│ public_server_name must be configured when server_provider is set to
│ 'NGINX'.

Expected behavior
Each property of the platform_reverse_proxy resource should be configurable with variables or results of other resources or data.

Additional context
Artifactory version: 7.98.9
Terraform version: 1.9.8
Provider version: 2.1.0

@piotrminkina piotrminkina added the bug Something isn't working label Dec 24, 2024
@piotrminkina
Copy link
Author

The same case is with the ssl_certificate_path and ssl_key_path properties when the use_https property is set to true.

│ Error: Missing Attribute Configuration
│ 
│   with platform_reverse_proxy.reverse_proxy,
│   on reverse_proxy.tf line 7, in resource "platform_reverse_proxy" "reverse_proxy":
│    7:   ssl_certificate_path        = var.ssl_certificate_path
│ 
│ ssl_certificate_path must be configured when use_https is set to 'true'.
╵
╷
│ Error: Missing Attribute Configuration
│ 
│   with platform_reverse_proxy.reverse_proxy,
│   on reverse_proxy.tf line 8, in resource "platform_reverse_proxy" "reverse_proxy":
│    8:   ssl_key_path                = var.ssl_key_path
│ 
│ ssl_key_path must be configured when use_https is set to 'true'.

@alexhung
Copy link
Member

alexhung commented Jan 2, 2025

@piotrminkina The second issue is unrelated. The error messages are self-explanatory 😄.

@piotrminkina
Copy link
Author

@alexhung The problem I reported is the inability to use variables in the properties of the resource. This applies to all the properties that I mentioned in these two comments. I give another example, this time a full example.

variable "artifactory_public_server_name" {
  type     = string
  default  = "localhost"
  nullable = false
}

variable "ssl_certificate_path" {
  type     = string
  default  = "path/to/file.crt"
  nullable = false
}

variable "ssl_key_path" {
  type     = string
  default  = "path/to/file.key"
  nullable = false
}

resource "platform_reverse_proxy" "reverse_proxy" {
  public_server_name          = var.artifactory_public_server_name
  internal_hostname           = "artifactory"
  server_provider             = "NGINX"
  docker_reverse_proxy_method = "SUBDOMAIN"
  use_https                   = true
  ssl_certificate_path        = var.ssl_certificate_path
  ssl_key_path                = var.ssl_key_path
}

With the following result for the terraform plan command.

╷
│ Error: Missing Attribute Configuration
│ 
│   with platform_reverse_proxy.reverse_proxy,
│   on reverse_proxy.tf line 30, in resource "platform_reverse_proxy" "reverse_proxy":
│   30:   public_server_name          = var.artifactory_public_server_name
│ 
│ public_server_name must be configured when server_provider is set to
│ 'NGINX'.
╵
╷
│ Error: Missing Attribute Configuration
│ 
│   with platform_reverse_proxy.reverse_proxy,
│   on reverse_proxy.tf line 35, in resource "platform_reverse_proxy" "reverse_proxy":
│   35:   ssl_certificate_path        = var.ssl_certificate_path
│ 
│ ssl_certificate_path must be configured when use_https is set to 'true'.
╵
╷
│ Error: Missing Attribute Configuration
│ 
│   with platform_reverse_proxy.reverse_proxy,
│   on reverse_proxy.tf line 36, in resource "platform_reverse_proxy" "reverse_proxy":
│   36:   ssl_key_path                = var.ssl_key_path
│ 
│ ssl_key_path must be configured when use_https is set to 'true'.

@alexhung
Copy link
Member

alexhung commented Jan 7, 2025

@piotrminkina Ah, I see. Let me look into this.

alexhung added a commit that referenced this issue Jan 7, 2025
…s-not-parameterizable

Fix reverse_proxy attributes not parameterizable
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

Successfully merging a pull request may close this issue.

2 participants