SnakeEye
SnakeEye

Reputation: 1

cdktf - HdinsightKafkaCluster - No stack could be identified for the construct at path

I'm trying to build cdktf - Java Infrastructure as Code for Azure. On the HdInsight Kafka Cluster i'm not able to produce the correct cdktf classes.

I'm always running in:


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'

My Code looks like:

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();
    }
...
 }
}

Where is my fault?

Upvotes: 0

Views: 394

Answers (1)

Daniel Schmidt
Daniel Schmidt

Reputation: 11921

Are you initialising this stack somewhere? e.g. in your Main.java? This part seems to be missing: https://github.com/hashicorp/terraform-cdk/blob/main/examples/java/aws/src/main/java/com/mycompany/app/Main.java#L50

Upvotes: 0

Related Questions