1. Packages
  2. Fastly
  3. API Docs
  4. getPackageHash
Fastly v8.7.0 published on Friday, May 10, 2024 by Pulumi

fastly.getPackageHash

Explore with Pulumi AI

fastly logo
Fastly v8.7.0 published on Friday, May 10, 2024 by Pulumi

    Use this data source to generate a SHA512 hash of all files (in sorted order) within the package.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    const example = fastly.getPackageHash({
        filename: "./path/to/package.tar.gz",
    });
    const exampleServiceCompute = new fastly.ServiceCompute("example", {"package": {
        filename: "./path/to/package.tar.gz",
        sourceCodeHash: example.then(example => example.hash),
    }});
    
    import pulumi
    import pulumi_fastly as fastly
    
    example = fastly.get_package_hash(filename="./path/to/package.tar.gz")
    example_service_compute = fastly.ServiceCompute("example", package=fastly.ServiceComputePackageArgs(
        filename="./path/to/package.tar.gz",
        source_code_hash=example.hash,
    ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-fastly/sdk/v8/go/fastly"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := fastly.GetPackageHash(ctx, &fastly.GetPackageHashArgs{
    			Filename: pulumi.StringRef("./path/to/package.tar.gz"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = fastly.NewServiceCompute(ctx, "example", &fastly.ServiceComputeArgs{
    			Package: &fastly.ServiceComputePackageArgs{
    				Filename:       pulumi.String("./path/to/package.tar.gz"),
    				SourceCodeHash: pulumi.String(example.Hash),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Fastly.GetPackageHash.Invoke(new()
        {
            Filename = "./path/to/package.tar.gz",
        });
    
        var exampleServiceCompute = new Fastly.ServiceCompute("example", new()
        {
            Package = new Fastly.Inputs.ServiceComputePackageArgs
            {
                Filename = "./path/to/package.tar.gz",
                SourceCodeHash = example.Apply(getPackageHashResult => getPackageHashResult.Hash),
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.fastly.FastlyFunctions;
    import com.pulumi.fastly.inputs.GetPackageHashArgs;
    import com.pulumi.fastly.ServiceCompute;
    import com.pulumi.fastly.ServiceComputeArgs;
    import com.pulumi.fastly.inputs.ServiceComputePackageArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = FastlyFunctions.getPackageHash(GetPackageHashArgs.builder()
                .filename("./path/to/package.tar.gz")
                .build());
    
            var exampleServiceCompute = new ServiceCompute("exampleServiceCompute", ServiceComputeArgs.builder()        
                .package_(ServiceComputePackageArgs.builder()
                    .filename("./path/to/package.tar.gz")
                    .sourceCodeHash(example.applyValue(getPackageHashResult -> getPackageHashResult.hash()))
                    .build())
                .build());
    
        }
    }
    
    resources:
      exampleServiceCompute:
        type: fastly:ServiceCompute
        name: example
        properties:
          package:
            filename: ./path/to/package.tar.gz
            sourceCodeHash: ${example.hash}
    variables:
      example:
        fn::invoke:
          Function: fastly:getPackageHash
          Arguments:
            filename: ./path/to/package.tar.gz
    

    Using getPackageHash

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getPackageHash(args: GetPackageHashArgs, opts?: InvokeOptions): Promise<GetPackageHashResult>
    function getPackageHashOutput(args: GetPackageHashOutputArgs, opts?: InvokeOptions): Output<GetPackageHashResult>
    def get_package_hash(content: Optional[str] = None,
                         filename: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetPackageHashResult
    def get_package_hash_output(content: Optional[pulumi.Input[str]] = None,
                         filename: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetPackageHashResult]
    func GetPackageHash(ctx *Context, args *GetPackageHashArgs, opts ...InvokeOption) (*GetPackageHashResult, error)
    func GetPackageHashOutput(ctx *Context, args *GetPackageHashOutputArgs, opts ...InvokeOption) GetPackageHashResultOutput

    > Note: This function is named GetPackageHash in the Go SDK.

    public static class GetPackageHash 
    {
        public static Task<GetPackageHashResult> InvokeAsync(GetPackageHashArgs args, InvokeOptions? opts = null)
        public static Output<GetPackageHashResult> Invoke(GetPackageHashInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPackageHashResult> getPackageHash(GetPackageHashArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: fastly:index/getPackageHash:getPackageHash
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Content string
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    Filename string
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    Content string
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    Filename string
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    content String
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    filename String
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    content string
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    filename string
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    content str
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    filename str
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    content String
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    filename String
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified

    getPackageHash Result

    The following output properties are available:

    Hash string
    A SHA512 hash of all files (in sorted order) within the package.
    Id string
    The provider-assigned unique ID for this managed resource.
    Content string
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    Filename string
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    Hash string
    A SHA512 hash of all files (in sorted order) within the package.
    Id string
    The provider-assigned unique ID for this managed resource.
    Content string
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    Filename string
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    hash String
    A SHA512 hash of all files (in sorted order) within the package.
    id String
    The provider-assigned unique ID for this managed resource.
    content String
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    filename String
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    hash string
    A SHA512 hash of all files (in sorted order) within the package.
    id string
    The provider-assigned unique ID for this managed resource.
    content string
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    filename string
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    hash str
    A SHA512 hash of all files (in sorted order) within the package.
    id str
    The provider-assigned unique ID for this managed resource.
    content str
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    filename str
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified
    hash String
    A SHA512 hash of all files (in sorted order) within the package.
    id String
    The provider-assigned unique ID for this managed resource.
    content String
    The contents of the Wasm deployment package as a base64 encoded string (e.g. could be provided using an input variable or via external data source output variable). Conflicts with filename. Exactly one of these two arguments must be specified
    filename String
    The path to the Wasm deployment package within your local filesystem. Conflicts with content. Exactly one of these two arguments must be specified

    Package Details

    Repository
    Fastly pulumi/pulumi-fastly
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the fastly Terraform Provider.
    fastly logo
    Fastly v8.7.0 published on Friday, May 10, 2024 by Pulumi