An open API service indexing awesome lists of open source software.

https://github.com/wearetechnative/terraform-null-url-parser

Parse a full url into seperate URL components
https://github.com/wearetechnative/terraform-null-url-parser

Last synced: 5 months ago
JSON representation

Parse a full url into seperate URL components

Awesome Lists containing this project

README

          

# terraform-null-url-parser ![](https://img.shields.io/github/actions/workflow/status/TechNative-B-V/terraform-null-url-parser/lint_test.yaml)

This module parses a given URL into seperate components.

[![](we-are-technative.png)](https://www.technative.nl)

## What is it good for?

Say you want to configure an S3 bucket as redirecting website. You can use
*url-parser* for setting `hostname`, `protocol` and `path` in your
`routing_rules`.

## Release workflow

This repository uses [pre-commit](https://pre-commit.com/) to ensure consistent documentation. This is accomplished by running "pre-commit" before committing your changes and will then execute the hooks defined in the [`.pre-commit-config.yaml`](.pre-commit-config.yaml) file.

You can install "pre-commit" by running "pip install pre-commit"

Once a commit is pushed, a github will run an automated test to validate that the new commit will not break anything.

## Usage

```hcl

module "target_url" {
source = "TechNative-B-V/terraform-null-url-parser/null"
version = "0.1.0"

url = "https://registry.terraform.io/namespaces/TechNative-B-V"
}

resource "aws_s3_bucket_website_configuration" "bucket_webconf" {

...

routing_rules = <
## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [url](#input\_url) | URL to parse | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [anchor](#output\_anchor) | Anchor component of URL. E.g http://test.com/index.html#second-paragrapth -> 'second-paragraph' |
| [hostname](#output\_hostname) | Hostname component of URL. E.g http://dev.test.com -> 'dev.test.com' |
| [parsed\_url](#output\_parsed\_url) | All URL components as map of strings |
| [path](#output\_path) | Path component of URL. E.g http://test.com/blog/one -> '/blog/one' |
| [path\_and\_param](#output\_path\_and\_param) | The path, query string and anchor components combined as one string. |
| [protocol](#output\_protocol) | Protocol component of URL. E.g http://test.com -> 'http' |
| [query](#output\_query) | Query string component of URL. E.g http://test.com/index.html?a=1&b=2 -> 'a=1&b2' |