https://pulumi.com logo
r

refined-terabyte-65361

10/20/2021, 10:05 PM
Hello I am trying to rerun pulumi up but i get below error
Copy code
aws:eks:Addon (coredns):

    error: 1 error occurred:

    	* error creating EKS Add-On : ResourceInUseException: Addon already exists.

    {

      RespMetadata: {

        StatusCode: 409,

        RequestID: "4c48c30e-3c0d-43d3-aa0b-2cca66f8335d"

      },

      Message_: "Addon already exists."

    }
earlier i created resource from pulumi itself and pulumi state refelcts that resource already exists I was expecting if the resource exists its should not complain that resource already exists
l

little-cartoon-10569

10/20/2021, 10:16 PM
Why is it being created? Do you have a new Pulumi name which is different from the Pulumi name of he resource in state?
r

refined-terabyte-65361

10/20/2021, 10:43 PM
yes earlier it was like this
Copy code
const eksAddonCoredns = new aws.eks.Addon(
    "eksAddon",
    {
      addonName: "coredns",
      clusterName: prefix,
      resolveConflicts: "OVERWRITE",
      addonVersion: eksAddonCorednsVersion,
    },

    {
      dependsOn: [k8sCluster],
    },
  );
now it is updated like this
Copy code
const eksAddonCoredns = new aws.eks.Addon(
    "Coredns",
    {
      addonName: "coredns",
      clusterName: prefix,
      resolveConflicts: "OVERWRITE",
      addonVersion: eksAddonCorednsVersion,
    },

    {
      dependsOn: [k8sCluster],
    },
  );
this part is updated
Copy code
new aws.eks.Addon(
    "Coredns"
l

little-cartoon-10569

10/20/2021, 10:45 PM
So that means that there two different resources. "eksAddon" is being deleted, and "Codedns" is being created.
Pulumi creates new resources before deleting old ones, in order reduce the risk of service interruption.
But because these are both the same resource, with the same ID, the creation fails, because you can't have 2 resources with the same AWS ID.
r

refined-terabyte-65361

10/20/2021, 10:46 PM
oh so i should first remove the resource and then recreate reosurce with new name is that right
l

little-cartoon-10569

10/20/2021, 10:46 PM
You could, but Pulumi has a better way.
You can add an alias to the opts of the resource, so that Pulumi knows that the new resource is actually the old one.
1
r

refined-terabyte-65361

10/20/2021, 10:46 PM
oh what us the better way ?
l

little-cartoon-10569

10/20/2021, 10:46 PM
It won't delete it.
r

refined-terabyte-65361

10/20/2021, 10:47 PM
oh is there link on how to add alias ?
l

little-cartoon-10569

10/20/2021, 10:47 PM
Looking for it now.
3 Views