PublicKey class

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")
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 main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/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
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
    std = {
      source = "pulumi/std"
    }
  }
}

resource "aws_cloudfront_publickey" "example" {
  comment     = "test public key"
  encoded_key = file("public_key.pem")
  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 com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.FileArgs;
import java.util.ArrayList;
import java.util.Arrays;
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

Import

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

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

Constructors

PublicKey(String name, {PublicKeyArgs? args, CustomResourceOptions? options})
Creates a new PublicKey. name The Pulumi resource name. args Arguments used to configure this PublicKey. The set of arguments for PublicKey. options Resource options controlling this resource's behavior.
PublicKey.reference(String urn)
Creates a typed reference to an existing PublicKey resource.

Properties

callerReference ↔ Output<String>
Internal value used by CloudFront to allow future updates to the public key configuration.
latefinal
childResources → Set<Resource>
finalinherited
comment ↔ Output<String?>
An optional comment about the public key.
latefinal
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
encodedKey ↔ Output<String>
The encoded public key that you want to add to CloudFront to use with features like field-level encryption.
latefinal
etag ↔ Output<String>
The current version of the public key. For example: E2QWRUHAPOMQZL.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<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.
latefinal
namePrefix ↔ Output<String>
The name for the public key. Conflicts with name.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {PublicKeyState? state, CustomResourceOptions? options}) → PublicKey
Gets an existing PublicKey resource's state with the given name and id.