1. Packages
  2. AWS Classic
  3. API Docs
  4. cloudfront
  5. KeyGroup

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.31.1 published on Thursday, Apr 18, 2024 by Pulumi

aws.cloudfront.KeyGroup

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.31.1 published on Thursday, Apr 18, 2024 by Pulumi

    Example Usage

    The following example below creates a CloudFront key group.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as std from "@pulumi/std";
    
    const example = new aws.cloudfront.PublicKey("example", {
        comment: "example public key",
        encodedKey: std.file({
            input: "public_key.pem",
        }).then(invoke => invoke.result),
        name: "example-key",
    });
    const exampleKeyGroup = new aws.cloudfront.KeyGroup("example", {
        comment: "example key group",
        items: [example.id],
        name: "example-key-group",
    });
    
    import pulumi
    import pulumi_aws as aws
    import pulumi_std as std
    
    example = aws.cloudfront.PublicKey("example",
        comment="example public key",
        encoded_key=std.file(input="public_key.pem").result,
        name="example-key")
    example_key_group = aws.cloudfront.KeyGroup("example",
        comment="example key group",
        items=[example.id],
        name="example-key-group")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudfront"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		invokeFile, err := std.File(ctx, &std.FileArgs{
    			Input: "public_key.pem",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		example, err := cloudfront.NewPublicKey(ctx, "example", &cloudfront.PublicKeyArgs{
    			Comment:    pulumi.String("example public key"),
    			EncodedKey: invokeFile.Result,
    			Name:       pulumi.String("example-key"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cloudfront.NewKeyGroup(ctx, "example", &cloudfront.KeyGroupArgs{
    			Comment: pulumi.String("example key group"),
    			Items: pulumi.StringArray{
    				example.ID(),
    			},
    			Name: pulumi.String("example-key-group"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.CloudFront.PublicKey("example", new()
        {
            Comment = "example public key",
            EncodedKey = Std.File.Invoke(new()
            {
                Input = "public_key.pem",
            }).Apply(invoke => invoke.Result),
            Name = "example-key",
        });
    
        var exampleKeyGroup = new Aws.CloudFront.KeyGroup("example", new()
        {
            Comment = "example key group",
            Items = new[]
            {
                example.Id,
            },
            Name = "example-key-group",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.cloudfront.PublicKey;
    import com.pulumi.aws.cloudfront.PublicKeyArgs;
    import com.pulumi.aws.cloudfront.KeyGroup;
    import com.pulumi.aws.cloudfront.KeyGroupArgs;
    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) {
            var example = new PublicKey("example", PublicKeyArgs.builder()        
                .comment("example public key")
                .encodedKey(StdFunctions.file(FileArgs.builder()
                    .input("public_key.pem")
                    .build()).result())
                .name("example-key")
                .build());
    
            var exampleKeyGroup = new KeyGroup("exampleKeyGroup", KeyGroupArgs.builder()        
                .comment("example key group")
                .items(example.id())
                .name("example-key-group")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:cloudfront:PublicKey
        properties:
          comment: example public key
          encodedKey:
            fn::invoke:
              Function: std:file
              Arguments:
                input: public_key.pem
              Return: result
          name: example-key
      exampleKeyGroup:
        type: aws:cloudfront:KeyGroup
        name: example
        properties:
          comment: example key group
          items:
            - ${example.id}
          name: example-key-group
    

    Create KeyGroup Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new KeyGroup(name: string, args: KeyGroupArgs, opts?: CustomResourceOptions);
    @overload
    def KeyGroup(resource_name: str,
                 args: KeyGroupArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def KeyGroup(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 items: Optional[Sequence[str]] = None,
                 comment: Optional[str] = None,
                 name: Optional[str] = None)
    func NewKeyGroup(ctx *Context, name string, args KeyGroupArgs, opts ...ResourceOption) (*KeyGroup, error)
    public KeyGroup(string name, KeyGroupArgs args, CustomResourceOptions? opts = null)
    public KeyGroup(String name, KeyGroupArgs args)
    public KeyGroup(String name, KeyGroupArgs args, CustomResourceOptions options)
    
    type: aws:cloudfront:KeyGroup
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args KeyGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args KeyGroupArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args KeyGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args KeyGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args KeyGroupArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var keyGroupResource = new Aws.CloudFront.KeyGroup("keyGroupResource", new()
    {
        Items = new[]
        {
            "string",
        },
        Comment = "string",
        Name = "string",
    });
    
    example, err := cloudfront.NewKeyGroup(ctx, "keyGroupResource", &cloudfront.KeyGroupArgs{
    	Items: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Comment: pulumi.String("string"),
    	Name:    pulumi.String("string"),
    })
    
    var keyGroupResource = new KeyGroup("keyGroupResource", KeyGroupArgs.builder()        
        .items("string")
        .comment("string")
        .name("string")
        .build());
    
    key_group_resource = aws.cloudfront.KeyGroup("keyGroupResource",
        items=["string"],
        comment="string",
        name="string")
    
    const keyGroupResource = new aws.cloudfront.KeyGroup("keyGroupResource", {
        items: ["string"],
        comment: "string",
        name: "string",
    });
    
    type: aws:cloudfront:KeyGroup
    properties:
        comment: string
        items:
            - string
        name: string
    

    KeyGroup Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The KeyGroup resource accepts the following input properties:

    Items List<string>
    A list of the identifiers of the public keys in the key group.
    Comment string
    A comment to describe the key group..
    Name string
    A name to identify the key group.
    Items []string
    A list of the identifiers of the public keys in the key group.
    Comment string
    A comment to describe the key group..
    Name string
    A name to identify the key group.
    items List<String>
    A list of the identifiers of the public keys in the key group.
    comment String
    A comment to describe the key group..
    name String
    A name to identify the key group.
    items string[]
    A list of the identifiers of the public keys in the key group.
    comment string
    A comment to describe the key group..
    name string
    A name to identify the key group.
    items Sequence[str]
    A list of the identifiers of the public keys in the key group.
    comment str
    A comment to describe the key group..
    name str
    A name to identify the key group.
    items List<String>
    A list of the identifiers of the public keys in the key group.
    comment String
    A comment to describe the key group..
    name String
    A name to identify the key group.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the KeyGroup resource produces the following output properties:

    Etag string
    The identifier for this version of the key group.
    Id string
    The provider-assigned unique ID for this managed resource.
    Etag string
    The identifier for this version of the key group.
    Id string
    The provider-assigned unique ID for this managed resource.
    etag String
    The identifier for this version of the key group.
    id String
    The provider-assigned unique ID for this managed resource.
    etag string
    The identifier for this version of the key group.
    id string
    The provider-assigned unique ID for this managed resource.
    etag str
    The identifier for this version of the key group.
    id str
    The provider-assigned unique ID for this managed resource.
    etag String
    The identifier for this version of the key group.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing KeyGroup Resource

    Get an existing KeyGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: KeyGroupState, opts?: CustomResourceOptions): KeyGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            comment: Optional[str] = None,
            etag: Optional[str] = None,
            items: Optional[Sequence[str]] = None,
            name: Optional[str] = None) -> KeyGroup
    func GetKeyGroup(ctx *Context, name string, id IDInput, state *KeyGroupState, opts ...ResourceOption) (*KeyGroup, error)
    public static KeyGroup Get(string name, Input<string> id, KeyGroupState? state, CustomResourceOptions? opts = null)
    public static KeyGroup get(String name, Output<String> id, KeyGroupState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Comment string
    A comment to describe the key group..
    Etag string
    The identifier for this version of the key group.
    Items List<string>
    A list of the identifiers of the public keys in the key group.
    Name string
    A name to identify the key group.
    Comment string
    A comment to describe the key group..
    Etag string
    The identifier for this version of the key group.
    Items []string
    A list of the identifiers of the public keys in the key group.
    Name string
    A name to identify the key group.
    comment String
    A comment to describe the key group..
    etag String
    The identifier for this version of the key group.
    items List<String>
    A list of the identifiers of the public keys in the key group.
    name String
    A name to identify the key group.
    comment string
    A comment to describe the key group..
    etag string
    The identifier for this version of the key group.
    items string[]
    A list of the identifiers of the public keys in the key group.
    name string
    A name to identify the key group.
    comment str
    A comment to describe the key group..
    etag str
    The identifier for this version of the key group.
    items Sequence[str]
    A list of the identifiers of the public keys in the key group.
    name str
    A name to identify the key group.
    comment String
    A comment to describe the key group..
    etag String
    The identifier for this version of the key group.
    items List<String>
    A list of the identifiers of the public keys in the key group.
    name String
    A name to identify the key group.

    Import

    Using pulumi import, import CloudFront Key Group using the id. For example:

    $ pulumi import aws:cloudfront/keyGroup:KeyGroup example 4b4f2r1c-315d-5c2e-f093-216t50jed10f
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.31.1 published on Thursday, Apr 18, 2024 by Pulumi