mapbox / mapbox/cloudfriend

Feature: PreCondition / TemplateCondition

Open
#30 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
74
Forks
10
PR merge metrics
No merged PRs in 30d

Description

**Summary** We need a feature `PreCondition` or `TemplateCondition` that allows for specifying a condition on a resource being included in template building.

**Use Case**: We currently use `Condition: NotInChina` for resources that are not applicable to China.

This breaks for resources that are not at all available in China, e.g. KMS.
The template is validated before any conditions are applied, which fails if the resource does not exist in AWS-CN. We need a condition that removes these resources before sending it to CFN.

**Example**:

```
KmsAccess: {
Action: ‘Kms:Decrypt’,
Effect: ‘Allow’,
Resource: ‘kms:keys:*’,
PreCondition: ‘NotInChina’
}
```

The resource should be removed from the template object, *before* being submitted to Cloudformation.

This may require a change in /[cfn-config](https://github.com/mapbox/cfn-config) also, since cloudfriend itself is region/deploy-agnostic I think.

cc @mapbox/platform

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing cloudfriend's template-building and validation flow, then inspect the linked /cfn-config boundary to determine which project owns region-specific behavior. Done means resources using the proposed condition are removed from the template object before submission to CloudFormation, including the KMS example.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.