1. Packages
  2. AWS
  3. API Docs
  4. cloudfront
  5. PublicKey
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.cloudfront.PublicKey

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Example Usage

    The following example below creates a CloudFront public key.

    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: "test public key",
        encodedKey: std.file({
            input: "public_key.pem",
        }).then(invoke => invoke.result),
        name: "test_key",
    });
    
    import pulumi
    import pulumi_aws as aws
    import pulumi_std as std
    
    example = aws.cloudfront.PublicKey("example",
        comment="test public key",
        encoded_key=std.file(input="public_key.pem").result,
        name="test_key")
    
    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
    		}
    		_, err = cloudfront.NewPublicKey(ctx, "example", &cloudfront.PublicKeyArgs{
    			Comment:    pulumi.String("test public key"),
    			EncodedKey: pulumi.String(invokeFile.Result),
    			Name:       pulumi.String("test_key"),
    		})
    		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 = "test public key",
            EncodedKey = Std.File.Invoke(new()
            {
                Input = "public_key.pem",
            }).Apply(invoke => invoke.Result),
            Name = "test_key",
        });
    
    });
    
    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(StdFunctions.file(FileArgs.builder()
                    .input("public_key.pem")
                    .build()).result())
                .name("test_key")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:cloudfront:PublicKey
        properties:
          comment: test public key
          encodedKey:
            fn::invoke:
              Function: std:file
              Arguments:
                input: public_key.pem
              Return: result
          name: test_key
    

    Create PublicKey Resource

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

    Constructor syntax

    new PublicKey(name: string, args: PublicKeyArgs, opts?: CustomResourceOptions);
    @overload
    def PublicKey(resource_name: str,
                  args: PublicKeyArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def PublicKey(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  encoded_key: Optional[str] = None,
                  comment: Optional[str] = None,
                  name: Optional[str] = None,
                  name_prefix: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

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

    var publicKeyResource = new Aws.CloudFront.PublicKey("publicKeyResource", new()
    {
        EncodedKey = "string",
        Comment = "string",
        Name = "string",
        NamePrefix = "string",
    });
    
    example, err := cloudfront.NewPublicKey(ctx, "publicKeyResource", &cloudfront.PublicKeyArgs{
    	EncodedKey: pulumi.String("string"),
    	Comment:    pulumi.String("string"),
    	Name:       pulumi.String("string"),
    	NamePrefix: pulumi.String("string"),
    })
    
    var publicKeyResource = new PublicKey("publicKeyResource", PublicKeyArgs.builder()
        .encodedKey("string")
        .comment("string")
        .name("string")
        .namePrefix("string")
        .build());
    
    public_key_resource = aws.cloudfront.PublicKey("publicKeyResource",
        encoded_key="string",
        comment="string",
        name="string",
        name_prefix="string")
    
    const publicKeyResource = new aws.cloudfront.PublicKey("publicKeyResource", {
        encodedKey: "string",
        comment: "string",
        name: "string",
        namePrefix: "string",
    });
    
    type: aws:cloudfront:PublicKey
    properties:
        comment: string
        encodedKey: string
        name: string
        namePrefix: string
    

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    NamePrefix string

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    NamePrefix string

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    namePrefix String

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    namePrefix string

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    name_prefix str

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    namePrefix String

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    NamePrefix string

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    NamePrefix string

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    namePrefix String

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    namePrefix string

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    name_prefix str

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    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. Note: Do not set if using the key's id in another resource (e.g. KeyGroup) since it will result in a dependency error from AWS. Instead, it is recommended to use Pulumi autonaming by leaving this property unset (default behavior) or set the namePrefix property to allow the provider to autoname the resource.
    namePrefix String

    The name for the public key. Conflicts with name.

    NOTE: When setting encoded_key value, there needs a newline at the end of string. Otherwise, multiple runs of pulumi will want to recreate the aws.cloudfront.PublicKey resource.

    Import

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

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

    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
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi