Hi Guys, I have a weird behavior: Create a class ...
# python
c
Hi Guys, I have a weird behavior: Create a class userData:
Copy code
import pulumi
import pulumi_cloudinit as cloudinit


class UserData(pulumi.ComponentResource):
    def __init__(
        self,
        prefix: str,
        content: str,
        opts: pulumi.ResourceOptions = None
    ):
        super().__init__('aws:UserData', prefix, {}, opts)
        self.opts = pulumi.ResourceOptions(parent=self).merge(opts)

        self.cloudinit_config = cloudinit.get_config(
            base64_encode=True,
            gzip=True,
            parts=[cloudinit.GetConfigPartArgs(
                content=content,
                content_type="text/cloud-config"
            )],
        )
I'm trying to render a Jinja2 template and pass to get_config:
Copy code
env = Environment(loader=FileSystemLoader('.'))
template = env.get_template('cloud_init.yml')

cloud_config_content = pulumi.Output.all(
        service_name=service_name,
        s3_region=current.name,
        bucket_name=bucket_name,
        root_password=root_password.result,
        auth_tenant_id=azure_ad_application.current.tenant_id,
        oauth_client_id=azure_ad_application.azuread_application.client_id,
        self_signed_cert=self_cert.certificate.cert_pem,
        self_signed_key=self_cert.private_key.private_key_pem
    ).apply(lambda kwargs: template.render(**kwargs))
then
Copy code
user_data_instance = UserData(
    prefix=prefix,
    content=cloud_config_content
)
If I create everything in advance (like the root_password, self_signed_key) it works just great, but if any of these value changes, I got this error: Exception: invoke of cloudinitindex/getConfiggetConfig failed: Missing required argument: The argument "part.0.content" is required, but no definition was found. ()
did anyone face this issue before?
a
Hi @cool-teacher-39254, sorry you are having issues. I couldn't find this problem in our issues - I'd really appreciate it if you could raise a new one with the details of how to reproduce it and we'll investigate! https://github.com/pulumi/pulumi-cloudinit/issues?q=is%3Aissue+is%3Aclosed