Pulumi Team! Is there any way to remove the random...
# general
Pulumi Team! Is there any way to remove the random string from the name of every resource when it is created through pulumi??
For most resources, set the 'name' property instead of letting Pulumi do it. However, be aware that this is likely to cause problems when you need to replace a resource. That randomized name is there to facilitate the normal Pulumi lifecycle.
Okay I tried that, It worked for creation of storage bucket. Now when I am trying to create deployment and service in gke the error is : *__self__._internal_init(resource_name, *args, *kwargs) TypeError: _internal_init() got an unexpected keyword argument 'name' Code:
Copy code
app_labels1 = { 'app': 'lukere' }
app_dep = k8s.apps.v1.Deployment('lukere-deployment',
        'selector': { 'matchLabels': app_labels1 },
        'replicas': 3,
        'template': {
            'metadata': { 'labels': app_labels1 },
            'spec': {
                'containers': [{
                    'name': 'lukere',
                    'image': lukere,

app_svc = k8s.core.v1.Service('lukere-service',
    metadata={ 'labels': app_labels1 },
        'type': 'LoadBalancer',
        'ports': [{ 'port': 80, 'targetPort': 8000, 'protocol': 'TCP' }],
        'selector': app_labels1,
That resource must not have a name property. You'll need to use the API docs to figure out what, if any, property is the equivalent for that resource.
Generally, it will have the same name as the property with the randomized suffix that you see in the console. Many resources don't have any property like that (SG rules, for example).
And to repeat my point earlier: doing this will cause problems with delete/replace operations later. If you're doing it because you don't like the look of the suffix, then I strongly advise against. You need a very good reason to remove the suffix: for example, you need a "well known" value that you can publish widely (e.g. a domain name, URL path component, or similar).
I completely understand your point. The reason I want to get rid of the random string is that we need to do some endpoint configuration, the settings are at different places in the python script and the script needs to be run several times. The standardized deployment and service name are highly required to have a touchless codebase.
👍 1
This is a good reason to have a fixed name: an external resource requires a well-known immutable name that can't be easily looked up on demand.