AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.11.0 published on Wednesday, Aug 17, 2022 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.Collections.Generic;
using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var examplePublicKey = new Aws.CloudFront.PublicKey("examplePublicKey", new()
    {
        Comment = "example public key",
        EncodedKey = File.ReadAllText("public_key.pem"),
    });

    var exampleKeyGroup = new Aws.CloudFront.KeyGroup("exampleKeyGroup", new()
    {
        Comment = "example key group",
        Items = new[]
        {
            examplePublicKey.Id,
        },
    });

});
package main

import (
	"io/ioutil"

	"github.com/pulumi/pulumi-aws/sdk/v5/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
	})
}
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 examplePublicKey = new PublicKey("examplePublicKey", PublicKeyArgs.builder()        
            .comment("example public key")
            .encodedKey(Files.readString(Paths.get("public_key.pem")))
            .build());

        var exampleKeyGroup = new KeyGroup("exampleKeyGroup", KeyGroupArgs.builder()        
            .comment("example key group")
            .items(examplePublicKey.id())
            .build());

    }
}
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 * as fs 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],
});

Coming soon!

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

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.

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

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.