I am using awscc provider to create core network in aws.
snippet of code:
from imports.awscc.networkmanager_core_network import NetworkmanagerCoreNetwork as Nm_Core_Network, \
NetworkmanagerCoreNetworkTags as Nm_Core_Network_Tags
_core_network = Nm_Core_Network(self, core_network_name,
global_network_id=global_network_id,
description=core_network_description,
policy_document=Fn.jsonencode(create_core_network_policy_document()),
the stack runs fine and creates the core network. After the stack execution, tfstate file stores core network owner account as Null(this is the bug):
"owner_account": null,
The next run of “cdktf deploy” without any changes in the stack, tries update “owner_account” parameter
~ resource "awscc_networkmanager_core_network" "name of the core network stack id" {
id = "core-network-id"
+ owner_account = (known after apply)
but since there is no actual change and cdktf is unable to parse the “owner_account” by calling cloud_control API, “cdktf deploy” is running for hours before timeout.
Still modifying... [id=core-network-id, 1h10m elapsed]
If you make direct call to cloud-control API, it does return the “owner_account” parameter:
% aws cloudcontrol list-resources --type-name AWS::NetworkManager::CoreNetwork
{
"ResourceDescriptions": [
{
"Identifier": "core-network-id",
"Properties": "{\"CoreNetworkId\":\"core-network-id\",\"GlobalNetworkId\":\"global-network-id\",\"Description\":\"Cdescription\",\"State\":\"AVAILABLE\",\"OwnerAccount\":\"<owner-account>\",\"Tags\":[],\"CoreNetworkArn\":\"arn:aws:networkmanager::<arn>\"}"
},
The only workaround is to ignore_changes using lifecyle meta-argument:
lifecycle=TerraformResourceLifecycle(
ignore_changes="all"
)
btw,
terraformoutput for:
TerraformOutput(self, "core_network_owner",
value=_core_network.owner_account)
fails:
TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at nJe (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:464:9638)
at kd (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:193:19924)
at ws (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:197:7164)
at Cv (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:197:983)
at $9 (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:197:911)
at Kf (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:197:766)
at cg (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:195:12546)
at /usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:193:4411
at Ga.unstable_runWithPriority (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:189:7574)
ERROR Cannot convert undefined or null to object
- at Function.entries (<anonymous>)
- nJe (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:464:9638)
- kd (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:193:19924)
- ws (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:197:7164)
- Cv (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:197:983)
- $9 (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:197:911)
- Kf (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:197:766)
- cg (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:195:12546)
- (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:193:4411)
- Ga.unstable_runWithPriority (/usr/local/Cellar/cdktf/0.13.0/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:189:7574)
cdktf --version
0.13.1
"terraformProviders": [
{
"name": "awscc",
"source": "hashicorp/awscc",
"version": "~> 0.32.0"
}