tfe-tfc-migration-tool
tfe-tfc-migration-tool copied to clipboard
configuration-versions not being migrated
Hello and thank you for writing this most excellent migration tool, my team and I have used it on hundreds of workspaces with a high degree of success. There are, however, several workspaces which are failing to have their configuration-versions migrated.
# Here is the workspace API object from the source TFE:
{
"data": {
"id": "ws-xKLi8WrpDcFgYZ85",
"type": "workspaces",
"attributes": {
"name": "company-ctg-dev-brand-app-component",
"auto-apply": false,
"created-at": "2020-10-06T15:47:26.575Z",
"environment": "default",
"locked": false,
"queue-all-runs": false,
"terraform-version": "1.0.3",
"working-directory": "live/dev/brand/component",
"speculative-enabled": true,
"allow-destroy-plan": false,
"auto-destroy-at": null,
"latest-change-at": "2022-07-04T09:04:44.413Z",
"operations": true,
"execution-mode": "remote",
"vcs-repo": null,
"vcs-repo-identifier": null,
"permissions": {
"can-update": true,
"can-destroy": true,
"can-queue-destroy": true,
"can-queue-run": true,
"can-queue-apply": true,
"can-read-state-versions": true,
"can-create-state-versions": true,
"can-read-variable": true,
"can-update-variable": true,
"can-lock": true,
"can-unlock": true,
"can-force-unlock": true,
"can-read-settings": true
},
"actions": {
"is-destroyable": false
},
"description": null,
"file-triggers-enabled": true,
"trigger-prefixes": [],
"source": "tfe-api",
"source-name": null,
"source-url": null
},
"relationships": {
"organization": {
"data": {
"id": "companytech",
"type": "organizations"
}
},
"ssh-key": {
"data": {
"id": "sshkey-i8gR8R5DgqWNXLEz",
"type": "ssh-keys"
},
"links": {
"related": "/api/v2/ssh-keys/sshkey-i8gR8R5DgqWNXLEz"
}
},
"current-run": {
"data": {
"id": "run-Z3uPJWcdns7Fu66H",
"type": "runs"
},
"links": {
"related": "/api/v2/runs/run-Z3uPJWcdns7Fu66H"
}
},
"latest-run": {
"data": {
"id": "run-Z3uPJWcdns7Fu66H",
"type": "runs"
},
"links": {
"related": "/api/v2/runs/run-Z3uPJWcdns7Fu66H"
}
},
"current-state-version": {
"data": {
"id": "sv-sqmLPZNypyj5Q1Gw",
"type": "state-versions"
},
"links": {
"related": "/api/v2/workspaces/ws-xKLi8WrpDcFgYZ85/current-state-version"
}
}
},
"links": {
"self": "/api/v2/organizations/companytech/workspaces/company-ctg-dev-brand-app-component"
}
}
}
# And then from this source TFE workspace here are
# its 1st page of configuration versions
{
"data": [
{
"id": "cv-ii7dzXJLCCGBcpcM",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-ii7dzXJLCCGBcpcM/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-ii7dzXJLCCGBcpcM"
}
},
{
"id": "cv-f8zE3PBUGVfVwmzc",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-f8zE3PBUGVfVwmzc/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-f8zE3PBUGVfVwmzc"
}
},
{
"id": "cv-Ki5RjQpmvNNLJY1D",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-Ki5RjQpmvNNLJY1D/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-Ki5RjQpmvNNLJY1D"
}
},
{
"id": "cv-6LBvxp7DvJ8m8E1w",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-6LBvxp7DvJ8m8E1w/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-6LBvxp7DvJ8m8E1w"
}
},
{
"id": "cv-vNLzybMxPwS5UriM",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-vNLzybMxPwS5UriM/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-vNLzybMxPwS5UriM"
}
},
{
"id": "cv-nS4EhM5hvojGJkfS",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-nS4EhM5hvojGJkfS/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-nS4EhM5hvojGJkfS"
}
},
{
"id": "cv-o7hpfUhsrxcgA272",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-o7hpfUhsrxcgA272/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-o7hpfUhsrxcgA272"
}
},
{
"id": "cv-VEPRzJLjnXXjBhyu",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-VEPRzJLjnXXjBhyu/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-VEPRzJLjnXXjBhyu"
}
},
{
"id": "cv-dD6GnKS5zcwa4bVC",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-dD6GnKS5zcwa4bVC/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-dD6GnKS5zcwa4bVC"
}
},
{
"id": "cv-wGxKa1oPsEghtsWD",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-wGxKa1oPsEghtsWD/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-wGxKa1oPsEghtsWD"
}
},
{
"id": "cv-sTRmzCybZ2LcXonL",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-sTRmzCybZ2LcXonL/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-sTRmzCybZ2LcXonL"
}
},
{
"id": "cv-K9AWZXi4gCDV5Gmr",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-K9AWZXi4gCDV5Gmr/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-K9AWZXi4gCDV5Gmr"
}
},
{
"id": "cv-G6EPKdTbYGpky5Df",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-G6EPKdTbYGpky5Df/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-G6EPKdTbYGpky5Df"
}
},
{
"id": "cv-Sp2bZTfxEwBUZ6hp",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-Sp2bZTfxEwBUZ6hp/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-Sp2bZTfxEwBUZ6hp"
}
},
{
"id": "cv-ouvStzaDJBjHGpR5",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-ouvStzaDJBjHGpR5/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-ouvStzaDJBjHGpR5"
}
},
{
"id": "cv-NtxGnCZCaLPnuG1o",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-NtxGnCZCaLPnuG1o/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-NtxGnCZCaLPnuG1o"
}
},
{
"id": "cv-P4jY1Zh31c8VQDGr",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-P4jY1Zh31c8VQDGr/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-P4jY1Zh31c8VQDGr"
}
},
{
"id": "cv-EcYArczNjjCAanR1",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-EcYArczNjjCAanR1/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-EcYArczNjjCAanR1"
}
},
{
"id": "cv-XJVUqJbXCyRRCU6T",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-XJVUqJbXCyRRCU6T/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-XJVUqJbXCyRRCU6T"
}
},
{
"id": "cv-FEr38FHQT7giJTTA",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"status": "uploaded",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-FEr38FHQT7giJTTA/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-FEr38FHQT7giJTTA"
}
}
],
"links": {
"self": "https://tfe.infra.company.tools/api/v2/workspaces/ws-xKLi8WrpDcFgYZ85/configuration-versions?page%5Bnumber%5D=1&page%5Bsize%5D=20",
"first": "https://tfe.infra.company.tools/api/v2/workspaces/ws-xKLi8WrpDcFgYZ85/configuration-versions?page%5Bnumber%5D=1&page%5Bsize%5D=20",
"prev": null,
"next": "https://tfe.infra.company.tools/api/v2/workspaces/ws-xKLi8WrpDcFgYZ85/configuration-versions?page%5Bnumber%5D=2&page%5Bsize%5D=20",
"last": "https://tfe.infra.company.tools/api/v2/workspaces/ws-xKLi8WrpDcFgYZ85/configuration-versions?page%5Bnumber%5D=368&page%5Bsize%5D=20"
},
"meta": {
"pagination": {
"current-page": 1,
"prev-page": null,
"next-page": 2,
"total-pages": 368,
"total-count": 7352
}
}
}
# And here is the workspace object from the
# target TFC
{
"data": {
"id": "ws-kRu4D3SPWjkDJYck",
"type": "workspaces",
"attributes": {
"allow-destroy-plan": false,
"auto-apply": false,
"auto-destroy-at": null,
"created-at": "2022-07-14T19:37:21.549Z",
"environment": "default",
"locked": false,
"name": "company-ctg-dev-brand-app-component",
"pull-request-outputs-enabled": false,
"queue-all-runs": false,
"speculative-enabled": true,
"structured-run-output-enabled": true,
"terraform-version": "1.0.3",
"working-directory": "live/dev/brand/component",
"global-remote-state": false,
"updated-at": "2022-07-14T20:13:52.485Z",
"resource-count": 127,
"apply-duration-average": null,
"plan-duration-average": null,
"policy-check-failures": null,
"run-failures": null,
"workspace-kpis-runs-count": null,
"latest-change-at": "2022-07-14T19:38:40.587Z",
"operations": true,
"execution-mode": "remote",
"vcs-repo": null,
"vcs-repo-identifier": null,
"permissions": {
"can-update": true,
"can-destroy": true,
"can-queue-run": true,
"can-read-variable": true,
"can-update-variable": true,
"can-read-state-versions": true,
"can-read-state-outputs": true,
"can-create-state-versions": true,
"can-queue-apply": true,
"can-lock": true,
"can-unlock": true,
"can-force-unlock": true,
"can-read-settings": true,
"can-manage-tags": true,
"can-manage-run-tasks": true,
"can-manage-assessments": true,
"can-read-assessment-results": true,
"can-queue-destroy": true
},
"actions": {
"is-destroyable": false
},
"description": null,
"file-triggers-enabled": true,
"trigger-prefixes": [],
"trigger-patterns": [],
"drift-detection": false,
"last-assessment-result-at": null,
"source": "tfe-api",
"source-name": null,
"source-url": null,
"tag-names": []
},
"relationships": {
"organization": {
"data": {
"id": "companylabs",
"type": "organizations"
}
},
"ssh-key": {
"data": {
"id": "sshkey-hFHPe3aZhUaxzcZP",
"type": "ssh-keys"
},
"links": {
"related": "/api/v2/ssh-keys/sshkey-hFHPe3aZhUaxzcZP"
}
},
"current-run": {
"data": null
},
"latest-run": {
"data": null
},
"outputs": {
"data": [],
"links": {
"related": "/api/v2/workspaces/ws-kRu4D3SPWjkDJYck/current-state-version-outputs"
}
},
"remote-state-consumers": {
"links": {
"related": "/api/v2/workspaces/ws-kRu4D3SPWjkDJYck/relationships/remote-state-consumers"
}
},
"current-state-version": {
"data": {
"id": "sv-cBoWBGZms99tCJMs",
"type": "state-versions"
},
"links": {
"related": "/api/v2/workspaces/ws-kRu4D3SPWjkDJYck/current-state-version"
}
},
"current-configuration-version": {
"data": {
"id": "cv-3Bym8JU9jVmCvbWW",
"type": "configuration-versions"
},
"links": {
"related": "/api/v2/configuration-versions/cv-3Bym8JU9jVmCvbWW"
}
},
"agent-pool": {
"data": null
},
"readme": {
"data": null
},
"current-assessment-result": {
"data": null
},
"vars": {
"data": [
{
"id": "var-V5bnFi1q6UnRVF3R",
"type": "vars"
},
{
"id": "var-pVLzKrzp1267VnQo",
"type": "vars"
},
{
"id": "var-puocqf12JvgzDVhY",
"type": "vars"
}
]
}
},
"links": {
"self": "/api/v2/organizations/companylabs/workspaces/company-ctg-dev-brand-app-component"
}
}
}
# And here is the non-matching
# configuration version object from that target TFC workspace
{
"data": [
{
"id": "cv-dUZgVEKbgJYYf9bC",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "terraform",
"speculative": true,
"status": "uploaded",
"status-timestamps": {
"uploaded-at": "2022-07-14T20:27:12+00:00"
},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-dUZgVEKbgJYYf9bC/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-dUZgVEKbgJYYf9bC",
"download": "/api/v2/configuration-versions/cv-dUZgVEKbgJYYf9bC/download"
}
},
{
"id": "cv-a44rx7jw9t8ZiRCi",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "terraform",
"speculative": true,
"status": "uploaded",
"status-timestamps": {
"uploaded-at": "2022-07-14T20:06:11+00:00"
},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-a44rx7jw9t8ZiRCi/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-a44rx7jw9t8ZiRCi",
"download": "/api/v2/configuration-versions/cv-a44rx7jw9t8ZiRCi/download"
}
},
{
"id": "cv-3Bym8JU9jVmCvbWW",
"type": "configuration-versions",
"attributes": {
"auto-queue-runs": false,
"error": null,
"error-message": null,
"source": "tfe-api",
"speculative": false,
"status": "pending",
"status-timestamps": {},
"changed-files": []
},
"relationships": {
"ingress-attributes": {
"data": null,
"links": {
"related": "/api/v2/configuration-versions/cv-3Bym8JU9jVmCvbWW/ingress-attributes"
}
}
},
"links": {
"self": "/api/v2/configuration-versions/cv-3Bym8JU9jVmCvbWW"
}
}
],
"links": {
"self": "https://app.terraform.io/api/v2/workspaces/ws-kRu4D3SPWjkDJYck/configuration-versions?page%5Bnumber%5D=1&page%5Bsize%5D=20",
"first": "https://app.terraform.io/api/v2/workspaces/ws-kRu4D3SPWjkDJYck/configuration-versions?page%5Bnumber%5D=1&page%5Bsize%5D=20",
"prev": null,
"next": null,
"last": "https://app.terraform.io/api/v2/workspaces/ws-kRu4D3SPWjkDJYck/configuration-versions?page%5Bnumber%5D=1&page%5Bsize%5D=20"
},
"meta": {
"pagination": {
"current-page": 1,
"page-size": 20,
"prev-page": null,
"next-page": null,
"total-pages": 1,
"total-count": 3
}
}
}
The state version objects are migrated just fine, but of course without the configuration versions no runs are migrated and thus the workspace is unusable it appears anyway because the UI is unable to plan-and-apply because it throws the following error:
![Screen Shot 2022-07-11 at 5 39 46 PM](https://user-images.githubusercontent.com/108352663/179258932-e3777360-d865-4ccc-bb14-ef1afe4ebba2.png)
This happens to be for a very heavily used repo and so I am uncomfortable attempting to create new configuration version objects, especially since given that the state version objects are being migrated successfully.