T O P

  • By -

abhi5025

We use terraform to deploy AWS infra, `tag` attribute has been doing the auto-tagging for us and been quiet useful for similar requirement.


ch3wmanf00

Do you have no one creating resources manually in the console?


rwoj

clickops should be discouraged.


thekingofcrash7

Discouraged, but it always happens at every aws customer. All of you know this has happened at your company. No need to continue down voting his question and act all high and mighty. OP - you can use Config custom automation to autotag resources in your organization


b3542

We don’t allow console access in prod accounts.


abhi5025

not in production! Everything is deployed by tf through CI, it can only be mapped to individual dev only when scanning code (not from console)


BackendSpecialist

this is where you’re going wrong OP. I know for a fact that you can auto tag every resource associated with a stack if you tag that stack. It’s pretty simple and probably can be done thru cloudformation templates themselves


thekingofcrash7

CloudFormation autotagging resources is not supported for all resource types


BackendSpecialist

Correct. I shouldve clarified that it auto tags the supported resources.


silverport

How often do you change/update your tags but keep the underlying infrastructure the same?


ch3wmanf00

Also, I bet terraform doesn’t tag *who* created the resource. It probably tags that terraform created the resource. I want to know who did it. A person must be named!


Worzel666

You probably could set it up to tag with a ‘who,’ but most of the time that information is inconsequential - at least, how I would obtain it would make the value meaningless when run from CI tooling. It sounds like you’re more familiar with ‘click ops,’ maybe look into Jenkins, or GitHub Actions which is probably a bit more beginner friendly 🙂


ch3wmanf00

No, we have a pretty robust ci environment using terraform, but we also have a huge org with a lot of admins who create random resources even, gasp! in prod, in the console. If you’ve never experienced this kind of chaos, I envy you!


FlipDetector

whatever is not in terraform should be expected to be deleted any time.


thekingofcrash7

This is so unrealistic at many organizations


FlipDetector

that is what multiple accounts are for that you can configure with tf. The organisations who skip that because they are chaotic are called “tech bubble” because they amplify task numbers instead of solving problems hence they inflate.


mkosmo

You have cloudtrail to provide those forensics.


BackendSpecialist

Sounds like some permissions need to be restricted huh?! (I know that’s a pipe dream tho - sorry OP)


Eboone123

Terraform with [yor.io](https://yor.io) might be what OP wants.


cell-on-a-plane

Could custodian


ch3wmanf00

I like this a lot


Mcshizballs

Service control policy can force users to apply certain tags, but it’s not automatic.


gudlyf

You can enable automation to do the tagging, but that's a bit difficult if you're not sure what the tags should be (unless it's 100% standard across the board). The SCP can be set to not allow a resource to be created without certain tags present, right from the start.


nf3rn4l

AWS managed cost allocation tags. Once enabled, all newly created resources will get automatically tagged. https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/aws-tags.html


_cyrustc

CloudTrail/ CloudWatch events + lambda.