GorillaStack / auto-tag

Automatically tag AWS resources on creation, for cost assignment
GNU General Public License v3.0
457 stars 158 forks source link

deploy_autotag.sh should not error when run more than once #124

Open robertwilkinson9 opened 8 months ago

robertwilkinson9 commented 8 months ago
[cloudshell-user@ip-10-4-67-153 ~]$ ./src/auto-tag/deploy_autotag.sh -r eu-west-2 --s3-bucket rw20240109-autotag-bucket create --custom-tags {"AutoTag_ManagedBy": "The Boss"}
    _______       __         _______
   |   _   .--.--|  |_.-----|       .---.-.-----.
   |.  1   |  |  |   _|  _  |.|   | |  _  |  _  |
   |.  _   |_____|____|_____`-|.  |-|___._|___  |
   |:  |   |                  |:  |       |_____|
   |::.|:. |                  |::.|
   `--- ---'                  `---'

******
****** Create Stacks
******

Which release version would you like to deploy? [0.5.10]: 0.5.9
The rw20240109-autotag-bucket S3 Bucket already exists, skipping bucket create
Initializing AutoTag release version 0.5.9
RELEASE_URL_QUERY is       .[] | select(.name = "0.5.9") |
      .assets[] | select( .name == "autotag-0.5.9.zip") |
      .browser_download_url
GITHUB_API_RELEASES_URL is https://api.github.com/repos/GorillaStack/auto-tag/releases
RELEASE_ZIP_FILE_URL is https://github.com/GorillaStack/auto-tag/releases/download/0.5.9/autotag-0.5.9.zip
Creating the Main CloudFormation Stack...

An error occurred (AlreadyExistsException) when calling the CreateStack operation: Stack [AutoTag] already exists
[cloudshell-user@ip-10-4-67-153 ~]$

This is the second run, I expected it not to error but to say everything was deployed but I see an error.

The S3 bucket is correctly identified and not re-created, but then ....

rayjanoka commented 8 months ago

if it is already created you'll need to use one of the update actions instead of using create.

Commands:
    create                    Create the AutoTag infrastructure
    delete                    Delete the AutoTag infrastructure
    update-release            Update the AutoTag infrastructure with a specific release version
    update-master             Update the AutoTag infrastructure with the latest from the master branch
    update-local              Update the AutoTag infrastructure with the local source code