Closed aserzhankou closed 1 year ago
@aserzhankou I tried to reproduce this crash but so far unable to. I started out with Xray provider 1.12.0 and created one local repo and a repo config:
terraform {
required_providers {
artifactory = {
source = "registry.terraform.io/jfrog/artifactory"
version = "9.7.2"
}
xray = {
source = "registry.terraform.io/jfrog/xray"
version = "1.12.0"
}
}
}
resource "artifactory_local_generic_repository" "local-generic-repo" {
key = "local-generic-repo"
xray_index = true
}
resource "xray_repository_config" "local-generic-xray-config" {
repo_name = artifactory_local_generic_repository.local-generic-repo.key
config {
retention_in_days = 90
}
}
Here's the shell output:
alexh@alexh-mac terraform-provider-xray % terraform init -upgrade
Initializing the backend...
Initializing provider plugins...
- Finding jfrog/artifactory versions matching "9.7.2"...
- Finding jfrog/xray versions matching "1.12.0"...
- Installing jfrog/xray v1.12.0...
- Installed jfrog/xray v1.12.0 (signed by a HashiCorp partner, key ID 2FA4D2A520237FA7)
- Using previously-installed jfrog/artifactory v9.7.2
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
alexh@alexh-mac terraform-provider-xray % 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:
# artifactory_local_generic_repository.local-generic-repo will be created
+ resource "artifactory_local_generic_repository" "local-generic-repo" {
+ blacked_out = false
+ cdn_redirect = false
+ id = (known after apply)
+ includes_pattern = "**/*"
+ key = "local-generic-repo"
+ package_type = (known after apply)
+ priority_resolution = false
+ project_environments = (known after apply)
+ repo_layout_ref = "simple-default"
+ xray_index = true
}
# xray_repository_config.local-generic-xray-config will be created
+ resource "xray_repository_config" "local-generic-xray-config" {
+ id = (known after apply)
+ repo_name = "local-generic-repo"
+ config {
+ retention_in_days = 90
}
}
Plan: 2 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
artifactory_local_generic_repository.local-generic-repo: Creating...
artifactory_local_generic_repository.local-generic-repo: Creation complete after 0s [id=local-generic-repo]
xray_repository_config.local-generic-xray-config: Creating...
xray_repository_config.local-generic-xray-config: Creation complete after 0s [id=local-generic-repo]
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
Then I upgrade the Xray provider version in HCL to 2.0.1 and run terraform plan
:
alexh@alexh-mac terraform-provider-xray % terraform init -upgrade
Initializing the backend...
Initializing provider plugins...
- Finding jfrog/artifactory versions matching "9.7.2"...
- Finding jfrog/xray versions matching "2.0.1"...
- Using previously-installed jfrog/artifactory v9.7.2
- Installing jfrog/xray v2.0.1...
- Installed jfrog/xray v2.0.1 (signed by a HashiCorp partner, key ID 2FA4D2A520237FA7)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
alexh@alexh-mac terraform-provider-xray % terraform plan
artifactory_local_generic_repository.local-generic-repo: Refreshing state... [id=local-generic-repo]
xray_repository_config.local-generic-xray-config: Refreshing state... [id=local-generic-repo]
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.
I'm using Terraform 1.6.3 so may be that affected my result. Can you try to upgrade to the latest Terraform?
@aserzhankou ok, I managed to reproduce this issue. Working on a fix.
Describe the bug Hello. Raising a separate issue, as it was suggested in the comments https://github.com/jfrog/terraform-provider-xray/issues/141#issuecomment-1785699139
I have problems with Xray provider upgrade from version to 1.12 to any version from 1.15 to 2.0.0.
In the plan I have a lot of UpgradeResourceState errors like this:
And as a result:
And x-ray config of repository is like this:
Requirements for and issue Artifactory 7.63.12 (with Enterprise Plus license) and Xray 3.81.8. TF 1.0.2
Expected behavior Absence of errors during upgrade attempt.
Additional context Add any other context about the problem here.