Hi Team, I am using the following example on the ...
# general
Hi Team, I am using the following example on the page to provision a new eks cluster . I use the same code to create 3 different cluster on the same stack . I would like know how I can delete one of the cluster using pulumi cli . https://www.pulumi.com/docs/guides/crosswalk/aws/eks/
Copy code
package main

import (

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Create an EKS cluster with the default configuration.
		cluster, err := eks.NewCluster(ctx, "my-cluster1", nil)
		if err != nil {
			return err

		// Export the cluster's kubeconfig.
		ctx.Export("kubeconfig", cluster.Kubeconfig)
		return nil
When you perform
pulumi up
it will perform the instructed updates (create the EKS cluster) then save a json state file. If you then change the code (e.g. to alter the cluster name) and perform
pulumi up
again, it will compare what your new code is specifying with the state that it saved the first time around. If they're different it will perform alterations. It may be that it has to delete the original cluster and create a new one. As your code isn't creating 3 stacks, my guess is that you have run it once and then lost the state somehow before altering the name of the cluster and running it again. Without the state, Pulumi doesn't know what to delete. Your cloud resources from the first run are orphaned and it starts again from scratch creating the new one. Once the resources are orphaned, it's hard to convince Pulumi that it should be managing them and so should delete them when running
pulumi destroy
. Maybe you know all this and I'm barking up the wrong tree. However, if not then please have a read of this: State and Backends | Pulumi
Hi @boundless-car-60268 , Thanks for replying to my message . You are right we may be facing the issue with orphaned resources. So to clarify if I need to crate 3 or more s3 buckets ? do they need to be added to the same main.go file? Our idea is to create a rest interface where user wont have access to the main.go code and they can select the project and stack using the rest interface and then create a s3 bucket by specifying the name of the bucket . There will a possibility where multiple user may be able to create multiple s3 buckets . And also looking for the ability to delete the specific s3 bucket which user has created on the specific stack without effecting other s3 buckets on the stack. What I am taking from above answer is that our main.go file should have all the resources defined on the main.go file , only than pulumi can deploy multiple s3 resources right ? Does that we mean we cannot provide rest interface which is running pulumi code to deploy multiple s3 buckets since end user wont have access to main.go code ?