AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

EncryptionConfig

Creates and manages an AWS XRay Encryption Config.

NOTE: Removing this resource from the provider has no effect to the encryption configuration within X-Ray.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new Aws.Xray.EncryptionConfig("example", new Aws.Xray.EncryptionConfigArgs
        {
            Type = "NONE",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/xray"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := xray.NewEncryptionConfig(ctx, "example", &xray.EncryptionConfigArgs{
			Type: pulumi.String("NONE"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new EncryptionConfig("example", EncryptionConfigArgs.builder()        
            .type("NONE")
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.xray.EncryptionConfig("example", type="NONE")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.xray.EncryptionConfig("example", {
    type: "NONE",
});
resources:
  example:
    type: aws:xray:EncryptionConfig
    properties:
      type: NONE

With KMS Key

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var current = Output.Create(Aws.GetCallerIdentity.InvokeAsync());
        var exampleKey = new Aws.Kms.Key("exampleKey", new Aws.Kms.KeyArgs
        {
            Description = "Some Key",
            DeletionWindowInDays = 7,
            Policy = current.Apply(current => @$"{{
  ""Version"": ""2012-10-17"",
  ""Id"": ""kms-tf-1"",
  ""Statement"": [
    {{
      ""Sid"": ""Enable IAM User Permissions"",
      ""Effect"": ""Allow"",
      ""Principal"": {{
        ""AWS"": ""arn:aws:iam::{current.AccountId}:root""
      }},
      ""Action"": ""kms:*"",
      ""Resource"": ""*""
    }}
  ]
}}
"),
        });
        var exampleEncryptionConfig = new Aws.Xray.EncryptionConfig("exampleEncryptionConfig", new Aws.Xray.EncryptionConfigArgs
        {
            Type = "KMS",
            KeyId = exampleKey.Arn,
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/kms"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/xray"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetCallerIdentity(ctx, nil, nil)
		if err != nil {
			return err
		}
		exampleKey, err := kms.NewKey(ctx, "exampleKey", &kms.KeyArgs{
			Description:          pulumi.String("Some Key"),
			DeletionWindowInDays: pulumi.Int(7),
			Policy:               pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Id\": \"kms-tf-1\",\n", "  \"Statement\": [\n", "    {\n", "      \"Sid\": \"Enable IAM User Permissions\",\n", "      \"Effect\": \"Allow\",\n", "      \"Principal\": {\n", "        \"AWS\": \"arn:aws:iam::", current.AccountId, ":root\"\n", "      },\n", "      \"Action\": \"kms:*\",\n", "      \"Resource\": \"*\"\n", "    }\n", "  ]\n", "}\n")),
		})
		if err != nil {
			return err
		}
		_, err = xray.NewEncryptionConfig(ctx, "exampleEncryptionConfig", &xray.EncryptionConfigArgs{
			Type:  pulumi.String("KMS"),
			KeyId: exampleKey.Arn,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var current = Output.of(AwsFunctions.getCallerIdentity());

        var exampleKey = new Key("exampleKey", KeyArgs.builder()        
            .description("Some Key")
            .deletionWindowInDays(7)
            .policy("""
{
  "Version": "2012-10-17",
  "Id": "kms-tf-1",
  "Statement": [
    {
      "Sid": "Enable IAM User Permissions",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::%s:root"
      },
      "Action": "kms:*",
      "Resource": "*"
    }
  ]
}
", current.apply(getCallerIdentityResult -> getCallerIdentityResult.accountId())))
            .build());

        var exampleEncryptionConfig = new EncryptionConfig("exampleEncryptionConfig", EncryptionConfigArgs.builder()        
            .type("KMS")
            .keyId(exampleKey.arn())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

current = aws.get_caller_identity()
example_key = aws.kms.Key("exampleKey",
    description="Some Key",
    deletion_window_in_days=7,
    policy=f"""{{
  "Version": "2012-10-17",
  "Id": "kms-tf-1",
  "Statement": [
    {{
      "Sid": "Enable IAM User Permissions",
      "Effect": "Allow",
      "Principal": {{
        "AWS": "arn:aws:iam::{current.account_id}:root"
      }},
      "Action": "kms:*",
      "Resource": "*"
    }}
  ]
}}
""")
example_encryption_config = aws.xray.EncryptionConfig("exampleEncryptionConfig",
    type="KMS",
    key_id=example_key.arn)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getCallerIdentity({});
const exampleKey = new aws.kms.Key("exampleKey", {
    description: "Some Key",
    deletionWindowInDays: 7,
    policy: current.then(current => `{
  "Version": "2012-10-17",
  "Id": "kms-tf-1",
  "Statement": [
    {
      "Sid": "Enable IAM User Permissions",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::${current.accountId}:root"
      },
      "Action": "kms:*",
      "Resource": "*"
    }
  ]
}
`),
});
const exampleEncryptionConfig = new aws.xray.EncryptionConfig("exampleEncryptionConfig", {
    type: "KMS",
    keyId: exampleKey.arn,
});
resources:
  exampleKey:
    type: aws:kms:Key
    properties:
      description: Some Key
      deletionWindowInDays: 7
      policy: |
        {
          "Version": "2012-10-17",
          "Id": "kms-tf-1",
          "Statement": [
            {
              "Sid": "Enable IAM User Permissions",
              "Effect": "Allow",
              "Principal": {
                "AWS": "arn:aws:iam::${current.accountId}:root"
              },
              "Action": "kms:*",
              "Resource": "*"
            }
          ]
        }        
  exampleEncryptionConfig:
    type: aws:xray:EncryptionConfig
    properties:
      type: KMS
      keyId: ${exampleKey.arn}
variables:
  current:
    Fn::Invoke:
      Function: aws:getCallerIdentity
      Arguments: {}

Create a EncryptionConfig Resource

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

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

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

Type string

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

KeyId string

An AWS KMS customer master key (CMK) ARN.

Type string

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

KeyId string

An AWS KMS customer master key (CMK) ARN.

type String

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

keyId String

An AWS KMS customer master key (CMK) ARN.

type string

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

keyId string

An AWS KMS customer master key (CMK) ARN.

type str

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

key_id str

An AWS KMS customer master key (CMK) ARN.

type String

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

keyId String

An AWS KMS customer master key (CMK) ARN.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing EncryptionConfig Resource

Get an existing EncryptionConfig 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?: EncryptionConfigState, opts?: CustomResourceOptions): EncryptionConfig
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        key_id: Optional[str] = None,
        type: Optional[str] = None) -> EncryptionConfig
func GetEncryptionConfig(ctx *Context, name string, id IDInput, state *EncryptionConfigState, opts ...ResourceOption) (*EncryptionConfig, error)
public static EncryptionConfig Get(string name, Input<string> id, EncryptionConfigState? state, CustomResourceOptions? opts = null)
public static EncryptionConfig get(String name, Output<String> id, EncryptionConfigState 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:
KeyId string

An AWS KMS customer master key (CMK) ARN.

Type string

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

KeyId string

An AWS KMS customer master key (CMK) ARN.

Type string

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

keyId String

An AWS KMS customer master key (CMK) ARN.

type String

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

keyId string

An AWS KMS customer master key (CMK) ARN.

type string

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

key_id str

An AWS KMS customer master key (CMK) ARN.

type str

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

keyId String

An AWS KMS customer master key (CMK) ARN.

type String

The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

Import

XRay Encryption Config can be imported using the region name, e.g.,

 $ pulumi import aws:xray/encryptionConfig:EncryptionConfig example us-west-2

Package Details

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

This Pulumi package is based on the aws Terraform Provider.