yeah - it's just a tracking variable that increments for each Release that goes out that isn't a rollback.
gorgeous-minister-41131
02/22/2023, 12:31 AM
I wasn't sure if Pulumi had some deterministic way of assigning an invocation/release/unique ID or if I should just write my own for the scope of the entire run..
gorgeous-minister-41131
02/22/2023, 12:34 AM
(for scope, I'm porting a native Helm chart that is utilizing this for generating the name of a
Job
resource, so I need an alternative that can provide me with a unique-yet-consistent value for each run)
I think I would be able to just use a random generated slug just fine, just wasn't sure..
Copy code
def random_id(length: int = 4) -> str:
"""
Generates a random n-length character hexidecimal ID that can be used for
naming, annotating, labeling or tagging a deployment, namespace etc.
"""
charsets: str = string.ascii_lowercase + string.digits
return "".join(random.choice(charsets) for _ in range(length))
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.