Cdktf-HdinsightKafkaCluster-无法为路径处的构造标识堆栈

cyej8jka  于 2022-09-21  发布在  Kafka
关注(0)|答案(1)|浏览(177)

我正在尝试将cdktf-Java基础设施构建为Azure的代码。在HDInsight Kafka集群上,我无法生成正确的cdktf类。

我总是跑进去:

Caused by: software.amazon.jsii.JsiiException: No stack could be identified for the construct at path 'dev-name-cluster'
    Error: No stack could be identified for the construct at path 'dev-name-cluster'

我的代码如下所示:

public class KafkaAnnonymous extends TerraformStack {

    public KafkaAnnonymous(Construct scope, String id, final Environment environment,`your text`
            ResourceGroup rg, String storageAccount, Network network, KeyVault kv) {
        super(scope, id);

        AzurermProvider.Builder.create(this, "azureProvider")
                .features(AzurermProviderFeatures.builder()
                        .build())
                .subscriptionId("<SUBSCRIPTION_ID>")
                .build();

        AzurermBackend.Builder.create(this)
                .resourceGroupName("g_rg")
                .storageAccountName("g_storage_account_name")
                .containerName("terraform")
                .key(String.format("%s.terraform.tfstate", id))
                .build();
        create(scope, id, environment, rg, storageAccount, network, kv);
    }

    private final void create(Construct scope, String id, final Environment environment,
            ResourceGroup rg, String storageAccount, Network network, KeyVault kv) {

        HdinsightKafkaCluster.Builder
            .create(scope, id)
            .clusterVersion("2.4.1")
            .resourceGroupName(rg.getResourceGroup().getName())
            .name(id)
            .location("westeurope")
            .tier("Standard")
            .componentVersion(componentVersion())
            .gateway(gateway(password))
            .storageAccount(storage(storageAccount))
            .roles(roles(network, password))
            .build();
    }
...
 }
}

我的错在哪里?

kqlmhetl

kqlmhetl1#

您是否在某个地方初始化此堆栈?例如,在您的Main.java中?这一部分似乎缺失了:https://github.com/hashicorp/terraform-cdk/blob/main/examples/java/aws/src/main/java/com/mycompany/app/Main.java#L50

相关问题