jfrog / terraform-provider-artifactory

Terraform provider to manage JFrog Artifactory
https://jfrog.com/artifactory
Apache License 2.0
275 stars 105 forks source link

Accepted 202 error #48

Closed neilbeukes closed 3 years ago

neilbeukes commented 3 years ago

Hi, I updated to the new version, 2.2.6 and on doing my terraform plan I get this :

image

neilbeukes commented 3 years ago

Might be on my side. Just thought because of new release it was strange. Thanks. Closing for now.

neilbeukes commented 3 years ago

So I did some testing and using version 2.2.5 this error definitely does not occur. Switching to 2.2.6 it gives me the above error.

chb0github commented 3 years ago

Can you provide a sample tf to reproduce? I suspect i know the issue already

On Mon, Mar 1, 2021, 23:25 Neil Beukes notifications@github.com wrote:

So I did some testing and using version 2.2.5 this error definitely does not occur. Switching to 2.2.6 it gives me the above error.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jfrog/terraform-provider-artifactory/issues/48#issuecomment-788682681, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALIRUHFVFI42BTAPMHID4DTBSHGZANCNFSM4YOEG7DA .

--

https://swampup.jfrog.com/?utm_source=email-signature&utm_medium=banner&utm_campaign=swampUP_Live&utm_term=2021

chb0github commented 3 years ago

BTW: We also have a gitter channel: https://gitter.im/jfrog/terraform

neilbeukes commented 3 years ago

So to replicate it on my side all I did was : main.tf:

resource "artifactory_local_repository" "test-provider_local" {
  key              = "test-provider-local"
  package_type     = "maven"
  handle_releases  = false
  handle_snapshots = true
  xray_index       = true
}

provider.tf:

terraform {
  required_version = "~> 0.14.0"
  required_providers {
    artifactory = {
      source  = "jfrog/artifactory"
      version = "= 2.2.6"
    }
  }
}

provider "artifactory" {
  url      = "<our internal artifactory instance>"
  username = "***"
  password = "***"
}
neilbeukes commented 3 years ago

Some notes:

neilbeukes commented 3 years ago

image

chb0github commented 3 years ago

Man! This is the easiest possible scenario! Ok, I will have a look soon

chb0github commented 3 years ago

terraform code:

terraform {
  required_version = "~> 0.14.0"
  required_providers {
    artifactory = {
      source  = "jfrog/artifactory"
      version = "2.2.6"
    }
  }
}

provider "artifactory" {
  url      = "https://partnership.jfrog.io"
  username = "yyy"
  password = "xxx"
}
resource "artifactory_local_repository" "test-provider_local" {
  key              = "test-provider-local"
  package_type     = "maven"
  handle_releases  = false
  handle_snapshots = true
  xray_index       = true
}

Result:

christianb@unifi terraform-provider-artifactory % terraform init

Initializing the backend...

Initializing provider plugins...
- Reusing previous version of jfrog/artifactory from the dependency lock file
- Using previously-installed jfrog/artifactory v2.2.6

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.
christianb@unifi terraform-provider-artifactory % terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # artifactory_local_repository.test-provider_local will be created
  + resource "artifactory_local_repository" "test-provider_local" {
      + blacked_out                     = (known after apply)
      + checksum_policy_type            = (known after apply)
      + docker_api_version              = (known after apply)
      + enable_file_lists_indexing      = (known after apply)
      + excludes_pattern                = (known after apply)
      + force_nuget_authentication      = (known after apply)
      + handle_releases                 = false
      + handle_snapshots                = true
      + id                              = (known after apply)
      + includes_pattern                = (known after apply)
      + key                             = "test-provider-local"
      + max_unique_snapshots            = (known after apply)
      + max_unique_tags                 = (known after apply)
      + package_type                    = "maven"
      + repo_layout_ref                 = (known after apply)
      + snapshot_version_behavior       = (known after apply)
      + suppress_pom_consistency_checks = (known after apply)
      + xray_index                      = true
    }

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

artifactory_local_repository.test-provider_local: Creating...
artifactory_local_repository.test-provider_local: Creation complete after 2s [id=test-provider-local]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
christianb@unifi terraform-provider-artifactory % 
chb0github commented 3 years ago

I noticed that you're using 2 files - let me try that

chb0github commented 3 years ago

I did it as you did it:

An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols:

Terraform will perform the following actions:

artifactory_local_repository.test-provider_local will be created

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

artifactory_local_repository.test-provider_local: Creating... artifactory_local_repository.test-provider_local: Creation complete after 2s [id=test-provider-local]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

chb0github commented 3 years ago
christianb@unifi terraform-provider-artifactory % curl -snL https://partnership.jfrog.io/artifactory/api/system/version/ | jq -re .version
7.15.3

I will try to get your version installed. But as it stands, I can't reproduce this

neilbeukes commented 3 years ago

Mmm, The fact that it works fine on one version and fails on the next is obviously pointing to some issue but yes... to find that issue seems difficult. I will continue looking at it on my side also. Thanks.

neilbeukes commented 3 years ago

@chb0github you mention I suspect i know the issue already, Anything I could try that you know of?

chb0github commented 3 years ago

No. I thought it was related to a bug I found earlier. I am going to do another release since the bug I found is a crash bug

chb0github commented 3 years ago

I pushed a new version of the provider with the bug I discovered fixed. If you're still having issues, run terraform again but this time include debugging output: TF_LOG=trace terraform apply

If I don't have something I can reproduce I will close the ticket. Feel free to open it back up if needed

neilbeukes commented 3 years ago

Thanks, ill look around and try and get around it. Thanks. Give me 2 days :)

neilbeukes commented 3 years ago

So just an update, update our Jfrog to 7.15.4 fixed this error. So clearly the new changes that went into the Provider requires a version newer than 7.12.X. Can Close this now. Thanks for your assistance :)

neilbeukes commented 3 years ago

An additional updated, so it is still happening so requires a reboot of artifactory and then the error disappears for about 3 days. Will report if we find the root cause.

chb0github commented 3 years ago

@neilbeukes - pretty clearly an artifactory issue - feel free to open a ticket with them