Bumps [github.com/hashicorp/terraform-plugin-sdk/v2](https://github.com/hashicorp/terraform-plugin-sdk) from 2.24.1 to 2.26.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-sdk/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-plugin-sdk/compare/v2.24.1...v2.26.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-sdk/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
35 lines
863 B
Go
35 lines
863 B
Go
package tfexec
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os/exec"
|
|
|
|
tfjson "github.com/hashicorp/terraform-json"
|
|
)
|
|
|
|
// MetadataFunctions represents the terraform metadata functions -json subcommand.
|
|
func (tf *Terraform) MetadataFunctions(ctx context.Context) (*tfjson.MetadataFunctions, error) {
|
|
err := tf.compatible(ctx, tf1_4_0, nil)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("terraform metadata functions was added in 1.4.0: %w", err)
|
|
}
|
|
|
|
functionsCmd := tf.metadataFunctionsCmd(ctx)
|
|
|
|
var ret tfjson.MetadataFunctions
|
|
err = tf.runTerraformCmdJSON(ctx, functionsCmd, &ret)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &ret, nil
|
|
}
|
|
|
|
func (tf *Terraform) metadataFunctionsCmd(ctx context.Context, args ...string) *exec.Cmd {
|
|
allArgs := []string{"metadata", "functions", "-json"}
|
|
allArgs = append(allArgs, args...)
|
|
|
|
return tf.buildTerraformCmd(ctx, nil, allArgs...)
|
|
}
|