Skip to content

Commit

Permalink
preparing v2.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuchard committed Feb 14, 2025
1 parent 7ff557a commit f7dbce3
Show file tree
Hide file tree
Showing 13 changed files with 245 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### 2.0.0 (Next)
### 2.0.0
- Implement `string` and `number` type custom functions.

### 1.6.0
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ This README is purposefully short as all documentation is generated with `terraf

This repository additionally does accept feature requests for e.g. additional functions or enhancements to current functions in the Github issue tracker.

### Upcoming 2.0.0 Release Announcement
If your version of Terraform is >= 1.8 then you can additionally invoke the provider custom functions instead of the data sources. Otherwise you must declare the data sources to utilize this plugin's functions.

### Upcoming 2.0 Release Announcement
- All functions as of version 1.6.0 will be re-implemented as custom provider functions.
- All new functions implemented after the release of version 2.0.0 will be custom provider functions only, and not data sources.
- All new functions implemented after the release of version 1.6.0 will be custom provider functions only, and not data sources.
- All data source functions that exist at the time of the release of version 1.6.0 will be maintained afterwards for any necessary bug fixes.
- Please upgrade to Terraform version >= 1.8 by the release of version 2.1.0 to ensure support for any new functions supported by this provider.
4 changes: 2 additions & 2 deletions docs/data-sources/sqrt.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "stdlib_sqrt Data Source - stdlib"
subcategory: ""
description: |-
Return the square root of an input parameter;.
Return the square root of an input parameter.
---

# stdlib_sqrt (Data Source)

Return the square root of an input parameter;.
Return the square root of an input parameter.

## Example Usage

Expand Down
37 changes: 37 additions & 0 deletions docs/functions/cut.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cut function - stdlib"
subcategory: ""
description: |-
Cut a string in two
---

# function: cut

Returns the strings before and after the first instance of the separator in the input string. Also returns whether or not the separator was found in the input string. The return is a tuple: `before`, `after`, `found`. If the separator is not found in the input string, then `found` will be false, `before` will be equal to `param`, and `after` will be an empty string.

## Example Usage

```terraform
# Return the separated strings:
provider::stdlib::cut("foobarbaz", "bar")
# result: ("foo", "bar", true)
# Return the separated strings with absent separator:
provider::stdlib::cut("foobarbaz", "pizza")
# result: ("foobarbaz", "", false)
```

## Signature

<!-- signature generated by tfplugindocs -->
```text
cut(string string, separator string) dynamic
```

## Arguments

<!-- arguments generated by tfplugindocs -->
1. `string` (String) Input string parameter for cutting around a separator.
1. `separator` (String) The separator for cutting the input string.

36 changes: 36 additions & 0 deletions docs/functions/exp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "exp function - stdlib"
subcategory: ""
description: |-
Determine exponential of a number
---

# function: exp

Return the base-e exponential of an input number parameter.

## Example Usage

```terraform
# Return the base e exponential of 0:
provider::stdlib::exp(0)
# result: 1
# Return the base e exponential of 1.0986122:
provider::stdlib::exp(1.0986122)
# result: 2.9999997339956828
```

## Signature

<!-- signature generated by tfplugindocs -->
```text
exp(number number) number
```

## Arguments

<!-- arguments generated by tfplugindocs -->
1. `number` (Number) Input number parameter for determining the base-e exponential.

37 changes: 37 additions & 0 deletions docs/functions/last_char.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "last_char function - stdlib"
subcategory: ""
description: |-
Determine last character(s) of a string
---

# function: last_char

Return the last character(s) of an input string parameter. Only the terminating character is returned by default unless a value for `num_chars` is defined.

## Example Usage

```terraform
# Return the last character of a string:
provider::stdlib::last_char("hello")
# result: "o"
# Return the last three characters of a string:
provider::stdlib::last_char("hello", 3)
# result: "llo"
```

## Signature

<!-- signature generated by tfplugindocs -->
```text
last_char(string string, number_of_characters number...) string
```

## Arguments

<!-- arguments generated by tfplugindocs -->
1. `string` (String) Input string parameter for determining the last character.
<!-- variadic argument generated by tfplugindocs -->
1. `number_of_characters` (Variadic, Number) Optional: The number of terminating characters at the end of the string to return (default: 1). This must be fewer than the number of characters in the input string.
41 changes: 41 additions & 0 deletions docs/functions/mod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "mod function - stdlib"
subcategory: ""
description: |-
Determine modulus of a number
---

# function: mod

Return the remainder of the dividend number divided by the divisor number.

## Example Usage

```terraform
# Return the remainder of 4 / 2:
provider::stdlib::mod(4, 2)
# result: 0
# Return the remainder of 5 / 3:
provider::stdlib::mod(5, 3)
# result: 2
# Return the remainder of 10 / 4.75:
provider::stdlib::mod(10, 4.75)
# result: 0.5
```

## Signature

<!-- signature generated by tfplugindocs -->
```text
mod(dividend number, divisor number) number
```

## Arguments

<!-- arguments generated by tfplugindocs -->
1. `dividend` (Number) The dividend number from which to divide.
1. `divisor` (Number) The divisor number by which to divide.

40 changes: 40 additions & 0 deletions docs/functions/round.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "round function - stdlib"
subcategory: ""
description: |-
Determine rounding of a number
---

# function: round

Return the nearest integer of an input parameter; rounding half away from zero.

## Example Usage

```terraform
# Return the rounding of of 1.2:
provider::stdlib::round(1.2)
# result: 1
# Return the rounding of of 1.8:
provider::stdlib::round(1.8)
# result: 2
# Return the rounding of of 1.5:
provider::stdlib::round(1.5)
# result: 2
```

## Signature

<!-- signature generated by tfplugindocs -->
```text
round(number number) number
```

## Arguments

<!-- arguments generated by tfplugindocs -->
1. `number` (Number) Input number parameter for determining the rounding.

40 changes: 40 additions & 0 deletions docs/functions/sqrt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "sqrt function - stdlib"
subcategory: ""
description: |-
Determine square root of a number
---

# function: sqrt

Return the square root of an input parameter.

## Example Usage

```terraform
# Return the square root of 4:
provider::stdlib::exp(4)
# result: 2
# Return the square root of 0:
provider::stdlib::exp(0)
# result: 0
# Return the square root of 2:
provider::stdlib::exp(2)
# result: 1.4142135623730951
```

## Signature

<!-- signature generated by tfplugindocs -->
```text
sqrt(number number) number
```

## Arguments

<!-- arguments generated by tfplugindocs -->
1. `number` (Number) Input number parameter for determining the square root. This number cannot be negative, infinite (positive or negative), or NaN.

6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ description: |-

The stdlib provider provides additional functions for use within Terraform's HCL2 configuration language.

The Terraform provider plugin "stdlib" provides additional functions for Terraform available as data sources. These data sources enable functionality not intrinsically available to Terraform, or streamlined within a single invocation. However, data sources are not as robustly invoked with inputs or returns as true intrinsic functions. Without true support for custom functions this becomes the next best available option.
The Terraform provider plugin "stdlib" provides additional functions for Terraform available as data sources and custom functions. These data sources and custom functions enable functionality either not intrinsically available to Terraform, or instead streamlined within a single invocation. However, data sources are not as robustly invoked with inputs or returns compared to true functions. Without the true support for custom functions in Terraform >= 1.8 then this becomes the next best available option. If you are using Terraform >= 1.8 then it is advised to use the custom functions instead of the data sources, but otherwise you will need to declare the data sources.

Use the navigation to the left to read about the available data sources which are each equivalent to Terraform functions.
Use the navigation to the left to read about the available custom functions, and the alternative data sources which are each equivalent to Terraform functions.

## Example Usage

Expand All @@ -20,7 +20,7 @@ terraform {
required_providers {
stdlib = {
source = "mschuchard/stdlib"
version = "~> 1.0"
version = "~> 2.0"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
stdlib = {
source = "mschuchard/stdlib"
version = "~> 1.0"
version = "~> 2.0"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func main() {
// start provider server
if err := providerserver.Serve(context.Background(), provider.New("1.6.0"), providerserver.ServeOpts{
if err := providerserver.Serve(context.Background(), provider.New("2.0.0"), providerserver.ServeOpts{
Address: "registry.terraform.io/mschuchard/stdlib",
}); err != nil {
log.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions templates/index.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ description: |-

{{ .Description | trimspace }}

The Terraform provider plugin "stdlib" provides additional functions for Terraform available as data sources. These data sources enable functionality not intrinsically available to Terraform, or streamlined within a single invocation. However, data sources are not as robustly invoked with inputs or returns as true intrinsic functions. Without true support for custom functions this becomes the next best available option.
The Terraform provider plugin "stdlib" provides additional functions for Terraform available as data sources and custom functions. These data sources and custom functions enable functionality either not intrinsically available to Terraform, or instead streamlined within a single invocation. However, data sources are not as robustly invoked with inputs or returns compared to true functions. Without the true support for custom functions in Terraform >= 1.8 then this becomes the next best available option. If you are using Terraform >= 1.8 then it is advised to use the custom functions instead of the data sources, but otherwise you will need to declare the data sources.

Use the navigation to the left to read about the available data sources which are each equivalent to Terraform functions.
Use the navigation to the left to read about the available custom functions, and the alternative data sources which are each equivalent to Terraform functions.

{{ if .HasExample -}}
## Example Usage
Expand Down

0 comments on commit f7dbce3

Please sign in to comment.