CDK code for Linode provider

Hi Terraform community,

I’m having an issue using Terraform’s CDK in Python. I’m wanting to automate the provisioning of infrastructure on Linode (a provider similar to Digital Ocean).

This project is motivated by computational science. I’m doing this for free on my own time/money as our country (Australia) doesn’t fund science to the appropriate level, instead it uses the money to pay it’s rich mates in mining.

I can’t seem to get the correct data structure that ‘jsii’ wants (see below), I believe. Note the token value has been deliberately obscured in this code snippet. Thank you in advance for any thoughts/pointers.

#!/usr/bin/env python
from constructs import Construct
from cdktf import App, TerraformStack
from cdktf_cdktf_provider_linode import *

class MyStack(TerraformStack):
    def __init__(self, scope: Construct, ns: str):
        super().__init__(scope, ns)

    # provide details to Linode
    LinodeProvider(
    scope = 'linodes:read_write',
    id = 'ID1',
    token = 'tokenValue')

The above code results in the following error.

File "/home/nchowlett/.local/share/virtualenvs/terraform-F87jVGAE/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 326, in send
    raise JSIIError(resp.error) from JavaScriptError(resp.stack)
jsii.errors.JSIIError: Expected object reference, got "linodes:read_write"

Thanks again for your contribution to science, Nick

scope should be set to self. Every created provider/resource/data source/etc has a scope parameter which can be though of as the parent container.

Thanks @jsteinich! I actually reverted to using the HCL language, but I may give your suggestion a crack later on, out of interest.