Awscc with CDKTF: Core Network unable to comprehend Global Network ID length

This is CDKTF code in python:

from cdktf import App, TerraformStack
from cdktf import TerraformOutput
from cdktf import App, TerraformStack
from constructs import Construct
from imports.awscc import networkmanager_core_network, provider,networkmanager_global_network

class GlobalNetworkStack(Construct):
    """
    Creates AWS Global Network

    """

    global_network_arn: str

    def __init__(self, scope: Construct, id: str):
        super().__init__(scope, id)

        global_network = networkmanager_global_network.NetworkmanagerGlobalNetwork(self, " Global Network",
                                                                                   description=" Global Network",

                                                                                   )
        TerraformOutput(self, "global_network",
                        value=global_network.arn)

        self.global_network_arn = global_network.arn

class CoreNetworkStack(TerraformStack):
    def __init__(self, scope: Construct, name: str):
        super().__init__(scope, name)


        provider.AwsccProvider(self, "awscc_provider",
                               )

        _global_network = GlobalNetworkStack(self, "GlobalNetwork")

        networkmanager_core_network.NetworkmanagerCoreNetwork(self, "core_network",
                                                              global_network_id=_global_network.global_network_arn,
                                                              )


app = App()
CoreNetworkStack(app, "Core_Network")

app.synth()

Error while creating core network:

some of the information (eg: aws account information) is replaced with placeholder (eg: < account-number >) to protect cloud information

1 Stack deploying     0 Stacks done     0 Stacks waiting
[2022-10-11T14:15:04.363] [ERROR] default - ╷
│ Error: AWS SDK Go Service Operation Incomplete
│
│   with awscc_networkmanager_core_network.core_network,
│   on cdk.tf.json line 49, in resource.awscc_networkmanager_core_network.core_network:
│   49:       }
│
│ Waiting for Cloud Control API service CreateResource operation completion
│ returned: waiter state transitioned to FAILED. StatusMessage: 1 validation
│ error detected: Value
│ 'arn:aws:networkmanager::<account-number>:global-network/<global-network-id>'
│ at 'globalNetworkId' failed to satisfy constraint: Member must have length
│ less than or equal to 50 (Service: NetworkManager, Status Code: 400,
│ Request ID: <request ID number>). ErrorCode:
Core_Network  ╷
                       │ Error: AWS SDK Go Service Operation Incomplete
                       │
                       │   with awscc_networkmanager_core_network.core_network (core_network),
                       │   on cdk.tf.json line 49, in resource.awscc_networkmanager_core_network.core_network (core_network):
                       │   49:       }
                       │
                       │ Waiting for Cloud Control API service CreateResource operation completion
                       │ returned: waiter state transitioned to FAILED. StatusMessage: 1 validation
                       │ error detected: Value
                       │ 'arn:aws:networkmanager::<account number>:global-network/<global Network id>'
                       │ at 'globalNetworkId' failed to satisfy constraint: Member must have length
                       │ less than or equal to 50 (Service: NetworkManager, Status Code: 400,
                       │ Request ID: <request ID number>). ErrorCode:
                       │ InvalidRequest

if we use the same Global Network ID directly with cloudcontrol API, core network is being created correctly.

aws cloudcontrol create-resource --type-name AWS::NetworkManager::CoreNetwork --desired-state ‘{“GlobalNetworkId”: “global-network-id”}’

Hi @exaws :wave:

It seems that you are passing _global_network.global_network_arn as the global_network_id. Does that property really contain the value "global-network-id"?
You could set that value in a TerraformOutput to debug what’s in that value and whether it exceeds the length limit of 50 chars.

stupid me… One of those days when you spend a whole day to figure a one line typo. :slight_smile:

Happens to the best of us! I still remember a situation a few years ago where I spent two days debugging something that needed one line to be moved upwards by two lines :smile: