Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Process-PSModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ permissions:

jobs:
Process-PSModule:
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@60bdf8a5a4c92c53fcf2a8d23f7d5f5c93e6864e # v5.4.3
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@11117919e65242d3388727819a751f74ad24ea9e # v5.5.0
secrets:
Comment on lines 29 to 31
APIKEY: ${{ secrets.APIKEY }}
78 changes: 50 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# {{ NAME }}
# Hcl

{{ DESCRIPTION }}
A PowerShell module for working with [HashiCorp Configuration Language (HCL)](https://github.com/hashicorp/hcl), as used in [Terraform](https://www.terraform.io/), [OpenTofu](https://opentofu.org/), and other infrastructure-as-code tools. Supports parsing `.tf` configuration files, `.tfvars` variable files, `locals {}` blocks, and converting PowerShell objects back to HCL format.
Comment on lines +1 to +3

## Prerequisites

Expand All @@ -12,58 +12,80 @@ This uses the following external resources:
To install the module from the PowerShell Gallery, you can use the following command:

```powershell
Install-PSResource -Name {{ NAME }}
Import-Module -Name {{ NAME }}
Install-PSResource -Name Hcl
Import-Module -Name Hcl
```

## Usage

Here is a list of example that are typical use cases for the module.
Here is a list of examples that are typical use cases for the module.

### Example 1: Greet an entity

Provide examples for typical commands that a user would like to do with the module.
### Example 1: Parse a Terraform locals block

```powershell
Greet-Entity -Name 'World'
Hello, World!
$hcl = @'
locals {
environment = "production"
region = "us-east-1"
tags = {
project = "myapp"
team = "platform"
}
}
'@
$result = ConvertFrom-Hcl -InputObject $hcl
$result.locals.environment # production
$result.locals.tags.project # myapp
Comment on lines +23 to +38
Comment on lines +36 to +38
```

### Example 2
### Example 2: Parse a .tfvars file

Provide examples for typical commands that a user would like to do with the module.
```powershell
$tfvars = Get-Content -Path 'terraform.tfvars' -Raw
$variables = ConvertFrom-Hcl -InputObject $tfvars
$variables.region # us-east-1
```

### Example 3: Convert a PowerShell object to HCL

```powershell
Import-Module -Name PSModuleTemplate
$config = [ordered]@{
resource = [ordered]@{
aws_instance = [ordered]@{
example = [ordered]@{
ami = 'ami-0c55b159cbfafe1f0'
instance_type = 't2.micro'
}
}
}
}
ConvertTo-Hcl -InputObject $config
```

### Find more examples

To find more examples of how to use the module, please refer to the [examples](examples) folder.

Alternatively, you can use the Get-Command -Module 'This module' to find more commands that are available in the module.
To find examples of each of the commands you can use Get-Help -Examples 'CommandName'.
Alternatively, you can use `Get-Command -Module 'Hcl'` to find commands available in the module.
To find examples of each command, use `Get-Help -Examples 'CommandName'`.

## Documentation

Link to further documentation if available, or describe where in the repository users can find more detailed documentation about
the module's functions and features.
For detailed documentation on each function, use the built-in help system:

```powershell
Get-Help ConvertFrom-Hcl -Full
Get-Help ConvertTo-Hcl -Full
```

## Contributing

Coder or not, you can contribute to the project! We welcome all contributions.

### For Users

If you don't code, you still sit on valuable information that can make this project even better. If you experience that the
product does unexpected things, throw errors or is missing functionality, you can help by submitting bugs and feature requests.
Please see the issues tab on this project and submit a new issue that matches your needs.

### For Developers
### For users

If you do code, we'd love to have your contributions. Please read the [Contribution guidelines](CONTRIBUTING.md) for more information.
You can either help by picking up an existing issue or submit a new one if you have an idea for a new feature or improvement.
If you don't code, you still sit on valuable information that can make this project even better. If you experience that the product does unexpected things, throw errors or is missing functionality, you can help by submitting bugs and feature requests. Please see the issues tab on this project and submit a new issue that matches your needs.

## Acknowledgements
### For developers

Here is a list of people and projects that helped this project in some way.
If you do code, we'd love to have your contributions. Please read the [Contribution guidelines](CONTRIBUTING.md) for more information. You can either help by picking up an existing issue or submit a new one if you have an idea for a new feature or improvement.
25 changes: 11 additions & 14 deletions examples/General.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
<#
<#
.SYNOPSIS
This is a general example of how to use the module.
This is a general example of how to use the Hcl module.
#>

# Import the module
Import-Module -Name 'PSModule'
Import-Module -Name 'Hcl'

# Define the path to the font file
$FontFilePath = 'C:\Fonts\CodeNewRoman\CodeNewRomanNerdFontPropo-Regular.tff'

# Install the font
Install-Font -Path $FontFilePath -Verbose

# List installed fonts
Get-Font -Name 'CodeNewRomanNerdFontPropo-Regular'

# Uninstall the font
Get-Font -Name 'CodeNewRomanNerdFontPropo-Regular' | Uninstall-Font -Verbose
# Convert an HCL locals block to a PowerShell object
$hcl = @'
locals {
environment = "production"
region = "us-east-1"
}
'@
ConvertFrom-Hcl -InputObject $hcl
3 changes: 0 additions & 3 deletions src/README.md

This file was deleted.

Binary file removed src/assemblies/LsonLib.dll
Binary file not shown.
15 changes: 0 additions & 15 deletions src/classes/private/SecretWriter.ps1

This file was deleted.

147 changes: 0 additions & 147 deletions src/classes/public/Book.ps1

This file was deleted.

3 changes: 0 additions & 3 deletions src/data/Config.psd1

This file was deleted.

3 changes: 0 additions & 3 deletions src/data/Settings.psd1

This file was deleted.

3 changes: 0 additions & 3 deletions src/finally.ps1

This file was deleted.

37 changes: 0 additions & 37 deletions src/formats/CultureInfo.Format.ps1xml

This file was deleted.

Loading
Loading