小编Vid*_*ya 的帖子

为什么 terraform plan 总是返回退出代码 0,即使有新资源要添加?

Terraform 提供以下退出代码:

0 = Succeeded with empty diff (no changes)
1 = Error
2 = Succeeded with non-empty diff (changes present)
Run Code Online (Sandbox Code Playgroud)

terraform apply仅当需要添加任何新资源或需要应用任何更改时,我才需要执行。

if [ $? -eq 0 ]; then
    echo "No changes, not applying"
elif [ $? -eq 1 ]; then
    echo "Terraform plan failed"
    exit 1
elif [ $? -eq 2 ]; then
    echo "Terraform apply needed"
fi
Run Code Online (Sandbox Code Playgroud)

但我得到退出代码0,即使对于terraform plan输出的命令:

Plan: 9 to add, 0 to change, 0 to destroy.
Run Code Online (Sandbox Code Playgroud)

有什么问题吗?

bash terraform

9
推荐指数
1
解决办法
6933
查看次数

如何在Python SDK API中获取cosmos查询消耗了多少请求单位

如何使用 python sdk 检查 Azure comsos DB 查询中每个请求消耗的请求单位数。

下面的代码仅打印特定 ReadItem 的响应输出,我也对查询消耗了多少请求单元感兴趣。

# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE.txt in the project root for
# license information.
# -------------------------------------------------------------------------
import azure.cosmos.cosmos_client as cosmos_client
import azure.cosmos.exceptions as exceptions
from azure.cosmos.partition_key import PartitionKey

from config import configs

HOST = configs['host']
MASTER_KEY = configs['key']
DATABASE_ID = configs['database_id']
CONTAINER_ID = configs['container_id']
client = cosmos_client.CosmosClient(HOST, {'masterKey': MASTER_KEY} )

def read_item(container, doc_id):
    id =  "9fedcb0991553b94b6e79595c9c26922b3c480940fc024fe4acd7dbad122d66b"
    pk= …
Run Code Online (Sandbox Code Playgroud)

python azure azure-api-apps azure-cosmosdb

3
推荐指数
1
解决办法
396
查看次数

标签 统计

azure ×1

azure-api-apps ×1

azure-cosmosdb ×1

bash ×1

python ×1

terraform ×1