Skip to main content

README

Overview

A custom Jinja filter for Sceptre for unquoting resolvers appearing in var files.

Motivation

In Sceptre, resolvers are an essential feature for simplifying complex configurations by enabling dynamic data retrieval. Resolvers such as !stack_output_external and !stack_output are particularly useful for referencing output values from other stacks or external sources, among many others.

When using resolvers in var files, however, they must be protected from being interpreted as YAML tags by the YAML loader.

This plugin addresses this challenge by allowing you to safely include resolvers in your var files. It ensures that resolvers are not processed as YAML tags by the loader, and then turned back into YAML tags after Jinja interpolation in the generated config.

Installation

Installation instructions

To install directly from PyPI

pip install jinja-unquote-resolvers-filter

To install from the git repo

pip install git+https://github.com/Sceptre/jinja-unquote-resolvers-filter.git

Usage/Examples

In your var file:

Subnets:
  - '!stack_output_external mystack::subnet_a'  # Quotes needed to protect a YAML tag.
  - '!stack_output_external mystack::subnet_b'

VPC: '!stack_output_external mystack::vpc_id'

In your config:

j2_environment:
  extensions:
    - jinja_unquote_resolvers_filter.UnquoteResolversFilterExtension

sceptre_user_data:
  subnets:
    {{ var.Subnets | unquote_resolvers(output_indent=4, trim=True) }}
  vpc: {{ var.VPC }}  # This filter is not needed if the quoted resolvers are passed in as scalars.

Arguments

  • indent (optional, default=2): The number of spaces to use for indentation of nested structures in the output YAML.
  • output_indent (optional, default=0): The number of spaces to use for indentation of the entire output YAML.
  • trim (optional, default=False): Whether to trim leading and trailing spaces in the output YAML.

Limitations

At this time, resolver expressions must be wrapped in a single line of text. That is, instead of:

my_multiline_resolver: |
  !from_json
    - !request http://www.whatever.com

Instead write:

my_multiline_resolver: '!from_json [!request http://www.whatever.com]'

Metadata

Release files for jinja-unquote-resolvers-filter 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jinja-unquote-resolvers-filter 1.1.0
File Size Uploaded Provenance
jinja_unquote_resolvers_filter-1.1.0.tar.gz 3.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for jinja-unquote-resolvers-filter 1.1.0
File Interpreter ABI Platform
jinja_unquote_resolvers_filter-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / jinja_unquote_resolvers_filter-1.1.0.tar.gz

Download URL jinja_unquote_resolvers_filter-1.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f78794403019b26de484a25cb0ea3682580a6d54e5cf456a0a5604e6c35e22ab
BLAKE2b-256 checksum
How to use checksums
47d017b34440692a508daaa0b8a206cacd3e713731a51736cee303ea85a051c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-1014-azure

Release files / jinja_unquote_resolvers_filter-1.1.0-py3-none-any.whl

Download URL jinja_unquote_resolvers_filter-1.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d931355ecf391984d6a7ebc9d4cabc1243ce82eefea307e5c3e7cd8118d3e398
BLAKE2b-256 checksum
How to use checksums
818d60bef9766c34b85bd1fbfb54fedddf55f35619235c4cf5801a2ee8d0a62d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-1014-azure

Security for jinja-unquote-resolvers-filter 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page