if the configmap already exists inside the cluster...
# kubernetes
i
if the configmap already exists inside the cluster (azure addons), can I somehow edit it using pulumi? Thanks
Copy code
error: resource kube-system/coredns-custom was not successfully created by the Kubernetes API server : configmaps "coredns-custom" already exists
b
i think you could used the pulumi import feature.
i
hm, looks very interesting, thanks! @big-potato-91793
@big-potato-91793 have you seen any examples? specifically using this with k8s. Thanks
b
Copy code
const secret = new k8s.core.v1.Secret('secret', {
    metadata: {
        labels: {
            ...context.commonLabels
        },
        annotations: context.commonAnnotations
    },

}, {
    import: 'id-of-the-resources'
});
If you look at your object you’re trying to create, you always have the
CustomResourceOptions
that have the property
import
Copy code
/**
     * When provided with a resource ID, import indicates that this resource's provider should import its state from
     * the cloud resource with the given ID. The inputs to the resource's constructor must align with the resource's
     * current state. Once a resource has been imported, the import property must be removed from the resource's
     * options.
     */
    import?: ID;
i
@big-potato-91793 I understand what you mean, but the problem on my side is AKS (Azure) install coredns on the resouerce init
I have no idea what’s the ID of that config map
basically, it’s configmap created in
kube-system
by azure on cluster init
g
import id for k8s resources is
[namespace/]name
e.g.,
kube-system/my-config-map
you can also use the
pulumi import
command to handle this for you
i
it can’t find it @gorgeous-egg-16927, already tried to use
ns/config-map