Delete export variable and help removing circular

2019-06-14 06:20发布

问题:

We have a Cloudformation stack, we export a ARN which is created by the stack and import it inside the same stack. When we try to delete the stack, It tries to delete the output first and realizes the output is in use and does not delete the stack.

We are looking for guidance on how to redeploy the stack or edit the stack so we can remove the dependency.

We tried editing the stack in config editor, but the changes not being saved and still get the same error when trying to delete the stack.

"UserPoolArn":{  
     "Description":"The ARN for Cognito User Pool",
     "Value":{  
        "Fn::GetAtt":[  
           "userPool",
           "Arn"
        ]
     },
     "Export":{  
        "Name":"organization:XX:UsersPoolArn"
     }

Import within the same cf stack
        "Environment":{  
           "Variables":{  

              "USER_POOL":{  
                 "Fn::ImportValue":"organization:XX:UsersPoolArn"
              }
           }
        }
     }

how we can remove the offending output key/value?

回答1:

My first try would be to replace the ImportValue line with whatever the value would be. Since your goal is to delete the stack, I'm not really concerned about hardcoding a value. Update the stack with that hard coded and once the stack gets to an update complete status, you should be able to delete the stack since the circular dependency has been removed.

Within a single stack, Ref is a far better choice than ImportValue. I'm pretty sure the stack couldn't be created with this configuration since the imported value won't be present when it validates the stack before launching so I'm guessing it was something that someone did in an update to the stack after it was created.