aws logo
AWS Classic v5.29.0, Feb 1 23

aws.cloudfront.PublicKey

Import

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

 $ pulumi import aws:cloudfront/publicKey:PublicKey example K3D5EWEUDCCXON

Example Usage

The following example below creates a CloudFront public key.

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

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

});
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 {
		_, err := cloudfront.NewPublicKey(ctx, "example", &cloudfront.PublicKeyArgs{
			Comment:    pulumi.String("test public key"),
			EncodedKey: readFileOrPanic("public_key.pem"),
		})
		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 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("test public key")
            .encodedKey(Files.readString(Paths.get("public_key.pem")))
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.cloudfront.PublicKey("example",
    comment="test public key",
    encoded_key=(lambda path: open(path).read())("public_key.pem"))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as fs from "fs";

const example = new aws.cloudfront.PublicKey("example", {
    comment: "test public key",
    encodedKey: fs.readFileSync("public_key.pem"),
});
resources:
  example:
    type: aws:cloudfront:PublicKey
    properties:
      comment: test public key
      encodedKey:
        fn::readFile: public_key.pem

Create PublicKey Resource

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

name string
The unique name of the resource.
args PublicKeyArgs
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 PublicKeyArgs
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 PublicKeyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args PublicKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args PublicKeyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

PublicKey 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 PublicKey resource accepts the following input properties:

EncodedKey string

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

Comment string

An optional comment about the public key.

Name string

The name for the public key. By default generated by this provider.

NamePrefix string

The name for the public key. Conflicts with name.

EncodedKey string

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

Comment string

An optional comment about the public key.

Name string

The name for the public key. By default generated by this provider.

NamePrefix string

The name for the public key. Conflicts with name.

encodedKey String

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

comment String

An optional comment about the public key.

name String

The name for the public key. By default generated by this provider.

namePrefix String

The name for the public key. Conflicts with name.

encodedKey string

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

comment string

An optional comment about the public key.

name string

The name for the public key. By default generated by this provider.

namePrefix string

The name for the public key. Conflicts with name.

encoded_key str

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

comment str

An optional comment about the public key.

name str

The name for the public key. By default generated by this provider.

name_prefix str

The name for the public key. Conflicts with name.

encodedKey String

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

comment String

An optional comment about the public key.

name String

The name for the public key. By default generated by this provider.

namePrefix String

The name for the public key. Conflicts with name.

Outputs

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

CallerReference string

Internal value used by CloudFront to allow future updates to the public key configuration.

Etag string

The current version of the public key. For example: E2QWRUHAPOMQZL.

Id string

The provider-assigned unique ID for this managed resource.

CallerReference string

Internal value used by CloudFront to allow future updates to the public key configuration.

Etag string

The current version of the public key. For example: E2QWRUHAPOMQZL.

Id string

The provider-assigned unique ID for this managed resource.

callerReference String

Internal value used by CloudFront to allow future updates to the public key configuration.

etag String

The current version of the public key. For example: E2QWRUHAPOMQZL.

id String

The provider-assigned unique ID for this managed resource.

callerReference string

Internal value used by CloudFront to allow future updates to the public key configuration.

etag string

The current version of the public key. For example: E2QWRUHAPOMQZL.

id string

The provider-assigned unique ID for this managed resource.

caller_reference str

Internal value used by CloudFront to allow future updates to the public key configuration.

etag str

The current version of the public key. For example: E2QWRUHAPOMQZL.

id str

The provider-assigned unique ID for this managed resource.

callerReference String

Internal value used by CloudFront to allow future updates to the public key configuration.

etag String

The current version of the public key. For example: E2QWRUHAPOMQZL.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing PublicKey Resource

Get an existing PublicKey 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?: PublicKeyState, opts?: CustomResourceOptions): PublicKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        caller_reference: Optional[str] = None,
        comment: Optional[str] = None,
        encoded_key: Optional[str] = None,
        etag: Optional[str] = None,
        name: Optional[str] = None,
        name_prefix: Optional[str] = None) -> PublicKey
func GetPublicKey(ctx *Context, name string, id IDInput, state *PublicKeyState, opts ...ResourceOption) (*PublicKey, error)
public static PublicKey Get(string name, Input<string> id, PublicKeyState? state, CustomResourceOptions? opts = null)
public static PublicKey get(String name, Output<String> id, PublicKeyState 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:
CallerReference string

Internal value used by CloudFront to allow future updates to the public key configuration.

Comment string

An optional comment about the public key.

EncodedKey string

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

Etag string

The current version of the public key. For example: E2QWRUHAPOMQZL.

Name string

The name for the public key. By default generated by this provider.

NamePrefix string

The name for the public key. Conflicts with name.

CallerReference string

Internal value used by CloudFront to allow future updates to the public key configuration.

Comment string

An optional comment about the public key.

EncodedKey string

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

Etag string

The current version of the public key. For example: E2QWRUHAPOMQZL.

Name string

The name for the public key. By default generated by this provider.

NamePrefix string

The name for the public key. Conflicts with name.

callerReference String

Internal value used by CloudFront to allow future updates to the public key configuration.

comment String

An optional comment about the public key.

encodedKey String

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

etag String

The current version of the public key. For example: E2QWRUHAPOMQZL.

name String

The name for the public key. By default generated by this provider.

namePrefix String

The name for the public key. Conflicts with name.

callerReference string

Internal value used by CloudFront to allow future updates to the public key configuration.

comment string

An optional comment about the public key.

encodedKey string

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

etag string

The current version of the public key. For example: E2QWRUHAPOMQZL.

name string

The name for the public key. By default generated by this provider.

namePrefix string

The name for the public key. Conflicts with name.

caller_reference str

Internal value used by CloudFront to allow future updates to the public key configuration.

comment str

An optional comment about the public key.

encoded_key str

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

etag str

The current version of the public key. For example: E2QWRUHAPOMQZL.

name str

The name for the public key. By default generated by this provider.

name_prefix str

The name for the public key. Conflicts with name.

callerReference String

Internal value used by CloudFront to allow future updates to the public key configuration.

comment String

An optional comment about the public key.

encodedKey String

The encoded public key that you want to add to CloudFront to use with features like field-level encryption.

etag String

The current version of the public key. For example: E2QWRUHAPOMQZL.

name String

The name for the public key. By default generated by this provider.

namePrefix String

The name for the public key. Conflicts with name.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.