aws-cloudformation / aws-cloudformation/cloudformation-pkl

Use global `Tag` instead of module specific tag

Open
#9 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Pkl
Stars
23
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Currently, each resource that accepts tags uses its own typing:

https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/organizations/account.pkl
![[https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/organizations/account.pkl](https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/organizations/account.pkl)](https://github.com/aws-cloudformation/cloudformation-pkl/assets/50992814/ee9774fb-7c46-44e1-8776-d43266a54b64)

https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/certificatemanager/certificate.pkl
![[https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/certificatemanager/certificate.pkl](https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/certificatemanager/certificate.pkl)](https://github.com/aws-cloudformation/cloudformation-pkl/assets/50992814/8d8fe00d-e443-482d-ba6f-e0f5ffa87f88)

https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/apigatewayv2/api.pkl
![[https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/apigatewayv2/api.pkl](https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/apigatewayv2/api.pkl)](https://github.com/aws-cloudformation/cloudformation-pkl/assets/50992814/62b7b638-9fd7-49f0-a920-8e17b215e60c)

https://github.com/aws-cloudformation/cloudformation-pkl/blob/main/package/aws/s3/bucket.pkl
![[
![image](https://github.com/aws-cloudformation/cloudformation-pkl/assets/50992814/56024a8e-116f-4eaa-a7cb-aaa4c959e60d)
](
![image](https://github.com/aws-cloudformation/cloudformation-pkl/assets/50992814/4a4ac857-3450-4b5c-98d8-e8f703cb4ffd)
)](https://github.com/aws-cloudformation/cloudformation-pkl/assets/50992814/8e956154-551e-401c-b16f-8eddb495c43f)

What I get, I **_some_** cases you need extra validation, like in the AccountTag, but most of the places you will have the exactly same thing:
```pkl
open class Tag {
Key: String|Mapping
Value: String|Mapping
}
```

Having multiple classes to do the same thing makes it impossible to use something like "default tags" for the resources, what would be very useful to create tags for the environment or similar repetitive tags.

Currently, if you try to do it, you get the error:
![image](https://github.com/aws-cloudformation/cloudformation-pkl/assets/50992814/badda9a2-5d11-451d-85f8-b58db625c5cb)

Contributor guide

Open the contributing guide

Research direction

Start by comparing the tag definitions in package/aws/organizations/account.pkl, package/aws/certificatemanager/certificate.pkl, package/aws/apigatewayv2/api.pkl, and package/aws/s3/bucket.pkl. Check where AccountTag needs extra validation versus the shared shape, then update the relevant resource definitions so a global Tag can be reused for default tags. Done means the common tag typing is consistent without losing resource-specific validation.

Written by the indexing model from the issue text.

Assessment

Domain
cloud
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.