terraform 显示返回 4 json 个对象
terraform show returning 4 json objects
What specific syntax must be changed below in order for the terraform cli to return only one json
object describing state instead of 4 json
objects?
我们目前运行的命令是:
terraform show --json
我们从上面的命令得到的结果包括4个json
对象如下:
2021-11-24T16:32:19.181-0800 [INFO] Terraform version: 1.0.8
2021-11-24T16:32:19.181-0800 [INFO] Go runtime version: go1.16.4
2021-11-24T16:32:19.181-0800 [INFO] CLI args: []string{"terraform", "show", "--json"}
2021-11-24T16:32:19.193-0800 [INFO] CLI command args: []string{"show", "--json"}
GET /containerName/my.tfstate HTTP/1.1
Host: myStorageAccountName.blob.core.windows.net
User-Agent: Terraform/1.0.8
X-Ms-Date: Thu, 25 Nov 2021 00:32:19 GMT
X-Ms-Version: 2018-11-09
Accept-Encoding: gzip
2021-11-24T16:32:20.752-0800 [DEBUG] Azure Backend Response for https://myStorageAccountName.blob.core.windows.net/containerName/my.tfstate:
HTTP/1.1 200 OK
Content-Length: 22852
Accept-Ranges: bytes
Content-Md5: someHashCode==
Content-Type: application/json
Date: Thu, 25 Nov 2021 00:32:19 GMT
Etag: "someHexTag"
Last-Modified: Tue, 23 Nov 2021 23:11:57 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
X-Ms-Blob-Type: BlockBlob
X-Ms-Creation-Time: Tue, 23 Nov 2021 23:02:50 GMT
X-Ms-Lease-State: available
X-Ms-Lease-Status: unlocked
X-Ms-Request-Id: another-request-id
X-Ms-Server-Encrypted: true
X-Ms-Version: 2018-11-09
{
"version": 4,
"terraform_version": "1.0.8",
"serial": 1,
"lineage": "...",
"outputs": { ... },
"resources": [ ... ]
}
2021-11-24T16:32:20.754-0800 [TRACE] backend/local: requesting state lock for workspace "default"
2021-11-24T16:32:20.754-0800 [TRACE] backend/local: reading remote state for workspace "default"
2021-11-24T16:32:20.754-0800 [DEBUG] Azure Backend Request:
GET /containerName/my.tfstate HTTP/1.1
Host: myStorageAccountName.blob.core.windows.net
User-Agent: Terraform/1.0.8
X-Ms-Date: Thu, 25 Nov 2021 00:32:20 GMT
X-Ms-Version: 2018-11-09
Accept-Encoding: gzip
2021-11-24T16:32:20.910-0800 [DEBUG] Azure Backend Response for https://myStorageAccountName.blob.core.windows.net/containerName/my.tfstate:
HTTP/1.1 200 OK
Content-Length: 22852
Accept-Ranges: bytes
Content-Md5: someHashCode==
Content-Type: application/json
Date: Thu, 25 Nov 2021 00:32:19 GMT
Etag: "someHexTag"
Last-Modified: Tue, 23 Nov 2021 23:11:57 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
X-Ms-Blob-Type: BlockBlob
X-Ms-Creation-Time: Tue, 23 Nov 2021 23:02:50 GMT
X-Ms-Lease-State: available
X-Ms-Lease-Status: unlocked
X-Ms-Request-Id: some-request-id
X-Ms-Server-Encrypted: true
X-Ms-Version: 2018-11-09
{
"version": 4,
"terraform_version": "1.0.8",
"serial": 1,
"lineage": "...",
"outputs": { ... },
"resources": [ ... ]
}
2021-11-24T16:32:20.925-0800 [INFO] provider: configuring client automatic mTLS
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Applications"..: timestamp=2021-11-24T16:32:21.017-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Applications"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "App Role Assignments"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "App Role Assignments"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "ConditionalAccess"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "ConditionalAccess"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Directory Roles"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Directory Roles"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Domains"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Domains"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Groups"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Groups"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Invitations"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Invitations"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Service Principals"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Service Principals"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.019-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Users"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.019-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Users"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.021-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: configuring server automatic mTLS: timestamp=2021-11-24T16:32:21.020-0800
2021-11-24T16:32:21.162-0800 [INFO] provider: configuring client automatic mTLS
2021-11-24T16:32:21.332-0800 [INFO] provider.terraform-provider-azurerm_v2.79.1_x5.exe: configuring server automatic mTLS: timestamp=2021-11-24T16:32:21.332-0800
2021-11-24T16:32:21.579-0800 [INFO] provider: configuring client automatic mTLS
2021-11-24T16:32:21.657-0800 [INFO] provider.terraform-provider-http_v2.1.0_x5.exe: configuring server automatic mTLS: timestamp=2021-11-24T16:32:21.656-0800
GET /containerName/my.tfstate HTTP/1.1
Host: myStorageAccountName.blob.core.windows.net
User-Agent: Terraform/1.0.8
X-Ms-Date: Thu, 25 Nov 2021 00:32:21 GMT
X-Ms-Version: 2018-11-09
Accept-Encoding: gzip
2021-11-24T16:32:22.288-0800 [DEBUG] Azure Backend Response for https://myStorageAccountName.blob.core.windows.net/containerName/my.tfstate:
HTTP/1.1 200 OK
Content-Length: 22852
Accept-Ranges: bytes
Content-Md5: someHashCode==
Content-Type: application/json
Date: Thu, 25 Nov 2021 00:32:21 GMT
Etag: "someHexTag"
Last-Modified: Tue, 23 Nov 2021 23:11:57 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
X-Ms-Blob-Type: BlockBlob
X-Ms-Creation-Time: Tue, 23 Nov 2021 23:02:50 GMT
X-Ms-Lease-State: available
X-Ms-Lease-Status: unlocked
X-Ms-Request-Id: a-third-request-id
X-Ms-Server-Encrypted: true
X-Ms-Version: 2018-11-09
{
"version": 4,
"terraform_version": "1.0.8",
"serial": 1,
"lineage": "...",
"outputs": { ... },
"resources": [ ... ]
}
2021-11-24T16:32:22.290-0800 [DEBUG] Azure Backend Request:
GET /containerName/my.tfstate HTTP/1.1
Host: myStorageAccountName.blob.core.windows.net
User-Agent: Terraform/1.0.8
X-Ms-Date: Thu, 25 Nov 2021 00:32:22 GMT
X-Ms-Version: 2018-11-09
Accept-Encoding: gzip
2021-11-24T16:32:22.462-0800 [DEBUG] Azure Backend Response for https://myStorageAccountName.blob.core.windows.net/containerName/my.tfstate:
HTTP/1.1 200 OK
Content-Length: 22852
Accept-Ranges: bytes
Content-Md5: someHashCode==
Content-Type: application/json
Date: Thu, 25 Nov 2021 00:32:21 GMT
Etag: "someHexTag"
Last-Modified: Tue, 23 Nov 2021 23:11:57 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
X-Ms-Blob-Type: BlockBlob
X-Ms-Creation-Time: Tue, 23 Nov 2021 23:02:50 GMT
X-Ms-Lease-State: available
X-Ms-Lease-Status: unlocked
X-Ms-Request-Id: a-4th-request-id
X-Ms-Server-Encrypted: true
X-Ms-Version: 2018-11-09
{
"version": 4,
"terraform_version": "1.0.8",
"serial": 1,
"lineage": "...",
"outputs": { ... },
"resources": [ ... ]
}
What specifically do we have to change in order to receive one single json
object in response which summarizes the state within that one single json
object?
这不是标准的 terraform show --json
输出。我怀疑您将 TF_LOG 设置为 DEBUG
或 INFO
。因此,您必须将该环境变量更改为正常值。例如,如果您 运行 它在 linux 的 bash
中,您可以按如下方式在一行中更改它:
TF_LOG=ERROR terraform show --json
或者,在像 Python 这样的 os-agnostic 语言中,您将使用两行不同的行,首先使用 [= 在一行上设置 TF_LOG=ERROR
16=] 然后 运行 在第二行 shell 命令到 运行 terraform show --json
使用类似 subprocess.popen
的命令。当然要记得之后将 TF_LOG
重新设置为用户默认设置的任何值。
What specific syntax must be changed below in order for the terraform cli to return only one
json
object describing state instead of 4json
objects?
我们目前运行的命令是:
terraform show --json
我们从上面的命令得到的结果包括4个json
对象如下:
2021-11-24T16:32:19.181-0800 [INFO] Terraform version: 1.0.8
2021-11-24T16:32:19.181-0800 [INFO] Go runtime version: go1.16.4
2021-11-24T16:32:19.181-0800 [INFO] CLI args: []string{"terraform", "show", "--json"}
2021-11-24T16:32:19.193-0800 [INFO] CLI command args: []string{"show", "--json"}
GET /containerName/my.tfstate HTTP/1.1
Host: myStorageAccountName.blob.core.windows.net
User-Agent: Terraform/1.0.8
X-Ms-Date: Thu, 25 Nov 2021 00:32:19 GMT
X-Ms-Version: 2018-11-09
Accept-Encoding: gzip
2021-11-24T16:32:20.752-0800 [DEBUG] Azure Backend Response for https://myStorageAccountName.blob.core.windows.net/containerName/my.tfstate:
HTTP/1.1 200 OK
Content-Length: 22852
Accept-Ranges: bytes
Content-Md5: someHashCode==
Content-Type: application/json
Date: Thu, 25 Nov 2021 00:32:19 GMT
Etag: "someHexTag"
Last-Modified: Tue, 23 Nov 2021 23:11:57 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
X-Ms-Blob-Type: BlockBlob
X-Ms-Creation-Time: Tue, 23 Nov 2021 23:02:50 GMT
X-Ms-Lease-State: available
X-Ms-Lease-Status: unlocked
X-Ms-Request-Id: another-request-id
X-Ms-Server-Encrypted: true
X-Ms-Version: 2018-11-09
{
"version": 4,
"terraform_version": "1.0.8",
"serial": 1,
"lineage": "...",
"outputs": { ... },
"resources": [ ... ]
}
2021-11-24T16:32:20.754-0800 [TRACE] backend/local: requesting state lock for workspace "default"
2021-11-24T16:32:20.754-0800 [TRACE] backend/local: reading remote state for workspace "default"
2021-11-24T16:32:20.754-0800 [DEBUG] Azure Backend Request:
GET /containerName/my.tfstate HTTP/1.1
Host: myStorageAccountName.blob.core.windows.net
User-Agent: Terraform/1.0.8
X-Ms-Date: Thu, 25 Nov 2021 00:32:20 GMT
X-Ms-Version: 2018-11-09
Accept-Encoding: gzip
2021-11-24T16:32:20.910-0800 [DEBUG] Azure Backend Response for https://myStorageAccountName.blob.core.windows.net/containerName/my.tfstate:
HTTP/1.1 200 OK
Content-Length: 22852
Accept-Ranges: bytes
Content-Md5: someHashCode==
Content-Type: application/json
Date: Thu, 25 Nov 2021 00:32:19 GMT
Etag: "someHexTag"
Last-Modified: Tue, 23 Nov 2021 23:11:57 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
X-Ms-Blob-Type: BlockBlob
X-Ms-Creation-Time: Tue, 23 Nov 2021 23:02:50 GMT
X-Ms-Lease-State: available
X-Ms-Lease-Status: unlocked
X-Ms-Request-Id: some-request-id
X-Ms-Server-Encrypted: true
X-Ms-Version: 2018-11-09
{
"version": 4,
"terraform_version": "1.0.8",
"serial": 1,
"lineage": "...",
"outputs": { ... },
"resources": [ ... ]
}
2021-11-24T16:32:20.925-0800 [INFO] provider: configuring client automatic mTLS
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Applications"..: timestamp=2021-11-24T16:32:21.017-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Applications"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "App Role Assignments"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "App Role Assignments"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "ConditionalAccess"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "ConditionalAccess"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Directory Roles"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Directory Roles"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Domains"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Domains"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Groups"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Groups"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Invitations"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Invitations"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Service Principals"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.018-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Service Principals"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.019-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Resources for "Users"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.019-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: 2021/11/24 16:32:21 [DEBUG] Registering Data Sources for "Users"..: timestamp=2021-11-24T16:32:21.018-0800
2021-11-24T16:32:21.021-0800 [INFO] provider.terraform-provider-azuread_v2.6.0_x5.exe: configuring server automatic mTLS: timestamp=2021-11-24T16:32:21.020-0800
2021-11-24T16:32:21.162-0800 [INFO] provider: configuring client automatic mTLS
2021-11-24T16:32:21.332-0800 [INFO] provider.terraform-provider-azurerm_v2.79.1_x5.exe: configuring server automatic mTLS: timestamp=2021-11-24T16:32:21.332-0800
2021-11-24T16:32:21.579-0800 [INFO] provider: configuring client automatic mTLS
2021-11-24T16:32:21.657-0800 [INFO] provider.terraform-provider-http_v2.1.0_x5.exe: configuring server automatic mTLS: timestamp=2021-11-24T16:32:21.656-0800
GET /containerName/my.tfstate HTTP/1.1
Host: myStorageAccountName.blob.core.windows.net
User-Agent: Terraform/1.0.8
X-Ms-Date: Thu, 25 Nov 2021 00:32:21 GMT
X-Ms-Version: 2018-11-09
Accept-Encoding: gzip
2021-11-24T16:32:22.288-0800 [DEBUG] Azure Backend Response for https://myStorageAccountName.blob.core.windows.net/containerName/my.tfstate:
HTTP/1.1 200 OK
Content-Length: 22852
Accept-Ranges: bytes
Content-Md5: someHashCode==
Content-Type: application/json
Date: Thu, 25 Nov 2021 00:32:21 GMT
Etag: "someHexTag"
Last-Modified: Tue, 23 Nov 2021 23:11:57 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
X-Ms-Blob-Type: BlockBlob
X-Ms-Creation-Time: Tue, 23 Nov 2021 23:02:50 GMT
X-Ms-Lease-State: available
X-Ms-Lease-Status: unlocked
X-Ms-Request-Id: a-third-request-id
X-Ms-Server-Encrypted: true
X-Ms-Version: 2018-11-09
{
"version": 4,
"terraform_version": "1.0.8",
"serial": 1,
"lineage": "...",
"outputs": { ... },
"resources": [ ... ]
}
2021-11-24T16:32:22.290-0800 [DEBUG] Azure Backend Request:
GET /containerName/my.tfstate HTTP/1.1
Host: myStorageAccountName.blob.core.windows.net
User-Agent: Terraform/1.0.8
X-Ms-Date: Thu, 25 Nov 2021 00:32:22 GMT
X-Ms-Version: 2018-11-09
Accept-Encoding: gzip
2021-11-24T16:32:22.462-0800 [DEBUG] Azure Backend Response for https://myStorageAccountName.blob.core.windows.net/containerName/my.tfstate:
HTTP/1.1 200 OK
Content-Length: 22852
Accept-Ranges: bytes
Content-Md5: someHashCode==
Content-Type: application/json
Date: Thu, 25 Nov 2021 00:32:21 GMT
Etag: "someHexTag"
Last-Modified: Tue, 23 Nov 2021 23:11:57 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
X-Ms-Blob-Type: BlockBlob
X-Ms-Creation-Time: Tue, 23 Nov 2021 23:02:50 GMT
X-Ms-Lease-State: available
X-Ms-Lease-Status: unlocked
X-Ms-Request-Id: a-4th-request-id
X-Ms-Server-Encrypted: true
X-Ms-Version: 2018-11-09
{
"version": 4,
"terraform_version": "1.0.8",
"serial": 1,
"lineage": "...",
"outputs": { ... },
"resources": [ ... ]
}
What specifically do we have to change in order to receive one single
json
object in response which summarizes the state within that one singlejson
object?
这不是标准的 terraform show --json
输出。我怀疑您将 TF_LOG 设置为 DEBUG
或 INFO
。因此,您必须将该环境变量更改为正常值。例如,如果您 运行 它在 linux 的 bash
中,您可以按如下方式在一行中更改它:
TF_LOG=ERROR terraform show --json
或者,在像 Python 这样的 os-agnostic 语言中,您将使用两行不同的行,首先使用 [= 在一行上设置 TF_LOG=ERROR
16=] 然后 运行 在第二行 shell 命令到 运行 terraform show --json
使用类似 subprocess.popen
的命令。当然要记得之后将 TF_LOG
重新设置为用户默认设置的任何值。