Sunday, September 4, 2022
HomeCyber SecurityExport title with XYZ is already exported by stack ABC | by...

Export title with XYZ is already exported by stack ABC | by Teri Radichel | Bugs That Chew | Sep, 2022


Creating distinctive export names for CloudFormation templates utilizing variables

Whereas writing my newest weblog publish collection on automating safety metrics I observed I had a bug that I by some means missed beforehand. If you happen to weren’t conscious of methods to overcome this concern you may assume that you should create separate CloudFormation templates once you want the exports from the identical template to have a distinct title every time it will get deployed, however that’s not the case.

The error above is telling me that I’ve two CloudFormation stacks making an attempt to make use of the identical export the identical title.

If I take a look at the main points of each these stacks I can see that they’re utilizing the identical template:

Let’s say you wrote your outputs to appear like this:

Outputs:
batchjobroleoutput:
Worth: !Ref BatchJobRole
Export:
Identify: batchjobrole
batchjobrolearnoutput:
Worth: !GetAtt BatchJobRole.Arn
Export:
Identify: batchjobrolearn

Which each and every template is run first will succeed and create your outputs. The second will fail.

In my case I had created a parameter and was appropriately utilizing it within the output to create a novel title for every template, and that’s how one can repair this downside. I attempted to publish the code right here however apparently Medium has a problem with my code for the time being so right here’s are a few screenshots.

The parameter offers the function a novel title:

The outputs use that title to create a novel export title:

My bug was that I failed added one other parameter that must be added to the export title now to make sure it’s distinctive. Alternatively I might change the title I’m passing into the templates. I used POC for the job title in each circumstances.

Right here’s one other tip. When you should deploy the identical assets in a number of areas, use the AWS::Area pseudo parameter within the title to maintain the names the identical aside from present area the place the useful resource will get deployed.

Teri Radichel

If you happen to preferred this story please clap and comply with:

Medium: Teri Radichel or Electronic mail Checklist: Teri Radichel
Twitter: @teriradichel or @2ndSightLab
Requests companies by way of LinkedIn: Teri Radichel or IANS Analysis

Β© 2nd Sight Lab 2022

____________________________________________

Writer:

Cybersecurity for Executives within the Age of Cloud on Amazon

Want Cloud Safety Coaching? 2nd Sight Lab Cloud Safety Coaching

Is your cloud safe? Rent 2nd Sight Lab for a penetration check or safety evaluation.

Have a Cybersecurity or Cloud Safety Query? Ask Teri Radichel by scheduling a name with IANS Analysis.

Cybersecurity & Cloud Safety Assets by Teri Radichel: Cybersecurity and Cloud safety courses, articles, white papers, displays, and podcasts



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments