aws.xray.EncryptionConfig
Explore with Pulumi AI
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
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.xray.EncryptionConfig("example", {type: "NONE"});
import pulumi
import pulumi_aws as aws
example = aws.xray.EncryptionConfig("example", type="NONE")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Xray.EncryptionConfig("example", new()
{
Type = "NONE",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.xray.EncryptionConfig;
import com.pulumi.aws.xray.EncryptionConfigArgs;
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 EncryptionConfig("example", EncryptionConfigArgs.builder()
.type("NONE")
.build());
}
}
resources:
example:
type: aws:xray:EncryptionConfig
properties:
type: NONE
With KMS Key
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const current = aws.getCallerIdentity({});
const example = current.then(current => aws.iam.getPolicyDocument({
statements: [{
sid: "Enable IAM User Permissions",
effect: "Allow",
principals: [{
type: "AWS",
identifiers: [`arn:aws:iam::${current.accountId}:root`],
}],
actions: ["kms:*"],
resources: ["*"],
}],
}));
const exampleKey = new aws.kms.Key("example", {
description: "Some Key",
deletionWindowInDays: 7,
policy: example.then(example => example.json),
});
const exampleEncryptionConfig = new aws.xray.EncryptionConfig("example", {
type: "KMS",
keyId: exampleKey.arn,
});
import pulumi
import pulumi_aws as aws
current = aws.get_caller_identity()
example = aws.iam.get_policy_document(statements=[{
"sid": "Enable IAM User Permissions",
"effect": "Allow",
"principals": [{
"type": "AWS",
"identifiers": [f"arn:aws:iam::{current.account_id}:root"],
}],
"actions": ["kms:*"],
"resources": ["*"],
}])
example_key = aws.kms.Key("example",
description="Some Key",
deletion_window_in_days=7,
policy=example.json)
example_encryption_config = aws.xray.EncryptionConfig("example",
type="KMS",
key_id=example_key.arn)
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
"github.com/pulumi/pulumi-aws/sdk/v6/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
}
example, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Sid: pulumi.StringRef("Enable IAM User Permissions"),
Effect: pulumi.StringRef("Allow"),
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "AWS",
Identifiers: []string{
fmt.Sprintf("arn:aws:iam::%v:root", current.AccountId),
},
},
},
Actions: []string{
"kms:*",
},
Resources: []string{
"*",
},
},
},
}, nil)
if err != nil {
return err
}
exampleKey, err := kms.NewKey(ctx, "example", &kms.KeyArgs{
Description: pulumi.String("Some Key"),
DeletionWindowInDays: pulumi.Int(7),
Policy: pulumi.String(example.Json),
})
if err != nil {
return err
}
_, err = xray.NewEncryptionConfig(ctx, "example", &xray.EncryptionConfigArgs{
Type: pulumi.String("KMS"),
KeyId: exampleKey.Arn,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var current = Aws.GetCallerIdentity.Invoke();
var example = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Sid = "Enable IAM User Permissions",
Effect = "Allow",
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "AWS",
Identifiers = new[]
{
$"arn:aws:iam::{current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId)}:root",
},
},
},
Actions = new[]
{
"kms:*",
},
Resources = new[]
{
"*",
},
},
},
});
var exampleKey = new Aws.Kms.Key("example", new()
{
Description = "Some Key",
DeletionWindowInDays = 7,
Policy = example.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var exampleEncryptionConfig = new Aws.Xray.EncryptionConfig("example", new()
{
Type = "KMS",
KeyId = exampleKey.Arn,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetCallerIdentityArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.kms.Key;
import com.pulumi.aws.kms.KeyArgs;
import com.pulumi.aws.xray.EncryptionConfig;
import com.pulumi.aws.xray.EncryptionConfigArgs;
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) {
final var current = AwsFunctions.getCallerIdentity();
final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.sid("Enable IAM User Permissions")
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("AWS")
.identifiers(String.format("arn:aws:iam::%s:root", current.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId())))
.build())
.actions("kms:*")
.resources("*")
.build())
.build());
var exampleKey = new Key("exampleKey", KeyArgs.builder()
.description("Some Key")
.deletionWindowInDays(7)
.policy(example.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var exampleEncryptionConfig = new EncryptionConfig("exampleEncryptionConfig", EncryptionConfigArgs.builder()
.type("KMS")
.keyId(exampleKey.arn())
.build());
}
}
resources:
exampleKey:
type: aws:kms:Key
name: example
properties:
description: Some Key
deletionWindowInDays: 7
policy: ${example.json}
exampleEncryptionConfig:
type: aws:xray:EncryptionConfig
name: example
properties:
type: KMS
keyId: ${exampleKey.arn}
variables:
current:
fn::invoke:
Function: aws:getCallerIdentity
Arguments: {}
example:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- sid: Enable IAM User Permissions
effect: Allow
principals:
- type: AWS
identifiers:
- arn:aws:iam::${current.accountId}:root
actions:
- kms:*
resources:
- '*'
Create EncryptionConfig Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new EncryptionConfig(name: string, args: EncryptionConfigArgs, opts?: CustomResourceOptions);
@overload
def EncryptionConfig(resource_name: str,
args: EncryptionConfigArgs,
opts: Optional[ResourceOptions] = None)
@overload
def EncryptionConfig(resource_name: str,
opts: Optional[ResourceOptions] = None,
type: Optional[str] = None,
key_id: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var encryptionConfigResource = new Aws.Xray.EncryptionConfig("encryptionConfigResource", new()
{
Type = "string",
KeyId = "string",
});
example, err := xray.NewEncryptionConfig(ctx, "encryptionConfigResource", &xray.EncryptionConfigArgs{
Type: pulumi.String("string"),
KeyId: pulumi.String("string"),
})
var encryptionConfigResource = new EncryptionConfig("encryptionConfigResource", EncryptionConfigArgs.builder()
.type("string")
.keyId("string")
.build());
encryption_config_resource = aws.xray.EncryptionConfig("encryptionConfigResource",
type="string",
key_id="string")
const encryptionConfigResource = new aws.xray.EncryptionConfig("encryptionConfigResource", {
type: "string",
keyId: "string",
});
type: aws:xray:EncryptionConfig
properties:
keyId: string
type: string
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:
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 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.
Import
Using pulumi import
, import XRay Encryption Config using the region name. For example:
$ pulumi import aws:xray/encryptionConfig:EncryptionConfig example us-west-2
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.