p

    prehistoric-shoe-5168

    6 months ago
    my pulumi code file is starting to get quite large. can someone point me to best practices here? 🧵
    i can provide some examples: i have already used pulling json files in… i’ll give you one in python where that isnt setup to work:
    scopes=[
            auth0.ResourceServerScopeArgs(
                description="Create foos",
                value="create:foo",
            ),
            auth0.ResourceServerScopeArgs(
                description="Create bars",
                value="create:bar",
            ),
    etc…. i have ~100 lines of json that will need to be converted to this format
    i found importing from other modules to be hinky
    b

    bored-oyster-3147

    6 months ago
    This is what component resources are for, so you can logically group your resources. Or since the entry point to your Pulumi project is a method you could just break your long code file into methods in other files that are invoked at the entry point.
    p

    prehistoric-shoe-5168

    6 months ago
    is there a nice example of either of these in use? the documentation only points to a TS example that is pretty opaque in terms of how it’d be used in a real project
    re: the entry point - that’s what i mean as being “hinky”. and i could be Doing It Wrong (TM)
    b

    bored-oyster-3147

    6 months ago
    There should be examples of component resources for a few of the different languages in the docs. As for code organization like splitting into methods, you would just use whatever means of organization makes sense for your language of choice. How your organize your code in your Pulumi project isn't really a question of Pulumi so much as it is a question of how it is done with that language. Maybe provide more info on what you mean by hinky? What's going wrong? Can you share code?
    g

    great-sunset-355

    6 months ago
    p

    prehistoric-shoe-5168

    6 months ago
    @bored-oyster-3147 - let me dig some up. this has been extremely helpful already.
    @great-sunset-355 - this is epic. exactly what i needed to get started here. i really like the data classes https://github.com/mitodl/ol-infrastructure/blob/main/src/ol_infrastructure/components/aws/cache.py