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."
│ } ]
│ }
│
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (1 by maintainers)
Commits related to this issue
- GH-718 fix the issue, when the resource can't deal with the replication call body, if it's a JSON object and not a list. - Modify test init function to use Mux provider — committed to jfrog/terraform-provider-artifactory by danielmkn a year ago
- Merge remote-tracking branch 'origin/GH-718-replication-config' into GH-718-replication-config — committed to jfrog/terraform-provider-artifactory by danielmkn a year ago
- Merge pull request #737 from jfrog/GH-718-replication-config GH-718, artifactory_local_repository_single_replication resource for ProX licenses. — committed to jfrog/terraform-provider-artifactory by danielmkn a year ago
@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.