terraform-provider-artifactory: Cannot use Replication. Error: "cannot unmarshal object into Go value"

Artifactory Version: 7.29.9 rev 72909900 License: ProX Terraform version: 1.4.4 Provider version: 6.35.0

I have tried to do a terraform import with juust about every replication resource. I get the same error on every one.

| Error: json: cannot unmarshal object into Go value of type []replication.getLocalSingleReplicationBody
or 
│ Error: json: cannot unmarshal object into Go value of type []replication.getReplicationBody

I am guessing this is related to the use of /api/replications vs /api/replications/multiple. It seems like most of the provider code is using the multiple endpoint in most cases.

To work around it, I figured, maybe I could try creating the resource using the artifactory_replication_config which appears to match our version of Artifactory; however, instead of using the /api/replications (which can be used by a ProX license) to create the resource, it is trying to use /api/replications/multiple which is for enterprise only. The rest of the endpoints for that resource use /api/replications

│ 403 PUT http://xxxx.xxxx.xxxx/artifactory/api/replications/multiple/myrepo
│ {
│   "errors" : [ {
│     "status" : 403,
│     "message" : "Multi-push replication is only available with an Enterprise license."
│   } ]
│ }
│

https://github.com/jfrog/terraform-provider-artifactory/blob/2a85ff6aaba173dc413649127e9b42bc09be88e9/pkg/artifactory/resource/replication/resource_artifactory_local_repository_single_replication.go#L44

https://github.com/jfrog/terraform-provider-artifactory/blob/2a85ff6aaba173dc413649127e9b42bc09be88e9/pkg/artifactory/resource/replication/resource_artifactory_replication_config.go#L242

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@danielmkn I stumbled on a similar situation in another part of the code base (but i don’t remember where). What i did was load raw data and marshal it to interface{} and then type inspect it. If it was a slice type, remarshalled it the right type as a slice, if not, i marshalled it to a single object of the right and added it to an empty slice.

Basically I normalized it through type inspection

@oyvsi, we will handle it in the provider. It won’t be fixed in the Artifactory. No ETA yet.