Open EugenMayer opened 11 months ago
I could reproduce this using the latest provider release (2.2.0) and Terraform 1.6.6
This is not happening all the time we want to modify a blobstore path, it only happens if you use an absolute path in the default Nexus blobs directory, for example /nexus-data/blobs/nexus-npm-proxy-cache
.
This is happening because Nexus itself is converting the path from absolute to relative while using the default blobs path /nexus-data/blobs/
(this is also reproducible using the UI/API) so when Terraform refresh the blobstore state Nexus answers with the relative path while Terraform wants to apply the absolute path.
Should we follow the same approach than Sonatype converting the absolute path to relative path in case of the default blobstore path is configured? What if someone else has configured by default another blobstore path?
As of now, I´d suggest to use relative paths in the Terraform declaration if you use the default blobstore path. I can confirm that this not happen while using relative path, please find below an example of path update working properly:
edu@edu-ThinkPad-T470s:~/Git/terraform-product$ terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# nexus_blobstore_file.tf-bs-test will be created
+ resource "nexus_blobstore_file" "tf-bs-test" {
+ available_space_in_bytes = (known after apply)
+ blob_count = (known after apply)
+ id = (known after apply)
+ name = "tf-bs-test"
+ path = "tf-random-path"
+ total_size_in_bytes = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
nexus_blobstore_file.tf-bs-test: Creating...
nexus_blobstore_file.tf-bs-test: Creation complete after 0s [id=tf-bs-test]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
edu@edu-ThinkPad-T470s:~/Git/terraform-product$ terraform apply
nexus_blobstore_file.tf-bs-test: Refreshing state... [id=tf-bs-test]
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:
# nexus_blobstore_file.tf-bs-test will be updated in-place
~ resource "nexus_blobstore_file" "tf-bs-test" {
id = "tf-bs-test"
name = "tf-bs-test"
~ path = "tf-random-path" -> "tf-random-path-CHANGED"
# (3 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
nexus_blobstore_file.tf-bs-test: Modifying... [id=tf-bs-test]
nexus_blobstore_file.tf-bs-test: Modifications complete after 0s [id=tf-bs-test]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
edu@edu-ThinkPad-T470s:~/Git/terraform-product$ terraform apply
nexus_blobstore_file.tf-bs-test: Refreshing state... [id=tf-bs-test]
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Is there an existing issue for this?
Community Note
-
Terraform Version
1.6.4
Nexus Provider Version
1.22.0
Nexus Version
3.62.2
Affected Resource(s)/Data Source(s)
nexus_blobstore_file
Terraform Configuration Files