Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

AWS Classic

v4.25.0 published on Friday, Oct 15, 2021 by Pulumi

KeyGroup

Import

CloudFront Key Group can be imported using the id, e.g.

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

Example Usage

using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var examplePublicKey = new Aws.CloudFront.PublicKey("examplePublicKey", new Aws.CloudFront.PublicKeyArgs
        {
            Comment = "example public key",
            EncodedKey = File.ReadAllText("public_key.pem"),
        });
        var exampleKeyGroup = new Aws.CloudFront.KeyGroup("exampleKeyGroup", new Aws.CloudFront.KeyGroupArgs
        {
            Comment = "example key group",
            Items = 
            {
                examplePublicKey.Id,
            },
        });
    }

}
package main

import (
	"io/ioutil"

	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cloudfront"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		examplePublicKey, err := cloudfront.NewPublicKey(ctx, "examplePublicKey", &cloudfront.PublicKeyArgs{
			Comment:    pulumi.String("example public key"),
			EncodedKey: readFileOrPanic("public_key.pem"),
		})
		if err != nil {
			return err
		}
		_, err = cloudfront.NewKeyGroup(ctx, "exampleKeyGroup", &cloudfront.KeyGroupArgs{
			Comment: pulumi.String("example key group"),
			Items: pulumi.StringArray{
				examplePublicKey.ID(),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

example_public_key = aws.cloudfront.PublicKey("examplePublicKey",
    comment="example public key",
    encoded_key=(lambda path: open(path).read())("public_key.pem"))
example_key_group = aws.cloudfront.KeyGroup("exampleKeyGroup",
    comment="example key group",
    items=[example_public_key.id])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * from "fs";

const examplePublicKey = new aws.cloudfront.PublicKey("examplePublicKey", {
    comment: "example public key",
    encodedKey: fs.readFileSync("public_key.pem"),
});
const exampleKeyGroup = new aws.cloudfront.KeyGroup("exampleKeyGroup", {
    comment: "example key group",
    items: [examplePublicKey.id],
});

Create a KeyGroup Resource

new KeyGroup(name: string, args: KeyGroupArgs, opts?: CustomResourceOptions);
@overload
def KeyGroup(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             comment: Optional[str] = None,
             items: Optional[Sequence[str]] = None,
             name: Optional[str] = None)
@overload
def KeyGroup(resource_name: str,
             args: KeyGroupArgs,
             opts: Optional[ResourceOptions] = None)
func NewKeyGroup(ctx *Context, name string, args KeyGroupArgs, opts ...ResourceOption) (*KeyGroup, error)
public KeyGroup(string name, KeyGroupArgs args, CustomResourceOptions? opts = null)
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.

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 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.

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 str
The identifier for this version of the key group.
id str
The provider-assigned unique ID for this managed resource.

Look up an 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)
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.

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 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.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.