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
- Host: GitHub
- URL: https://github.com/wearetechnative/terraform-null-url-parser
- Owner: wearetechnative
- License: apache-2.0
- Created: 2023-10-18T07:49:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-14T13:22:33.000Z (over 1 year ago)
- Last Synced: 2025-01-31T12:12:36.377Z (over 1 year ago)
- Language: HCL
- Homepage: https://registry.terraform.io/modules/TechNative-B-V/url-parser/null/latest
- Size: 200 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# terraform-null-url-parser 
This module parses a given URL into seperate components.
[](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' |