In an attempt to easily group blocks of resources ...
# python
s
In an attempt to easily group blocks of resources into a component resource, I wrote this (potentially-cursed) python module that lets you group sets of resources into single-use components without the boilerplate that is currently involved in setting up the component resource class. It allows you to group a set of resources in the following manner:
Copy code
class PermissionedDockerRegistry(
    ResourceGroup
):
    repository = gcp.artifactregistry.Repository(
        location="US",
        format="DOCKER",
    )
    iam_policy = gcp.artifactregistry.RepositoryIamPolicy(
        location="US",
        repository=repository.id,
        policy_data=policy.policy_data
    )
Ultimately, the benefit of using components for grouping doesn’t seem to outweigh the complexity so I will probably avoid using them for most cases, but I thought I would share in case others find the approach useful