Try AWS Native preview for resources not in the classic version.
aws.securityhub.ConfigurationPolicyAssociation
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Manages Security Hub configuration policy associations.
NOTE: This resource requires
aws.securityhub.OrganizationConfiguration
to be configured with typeCENTRAL
. More information about Security Hub central configuration and configuration policies can be found in the How Security Hub configuration policies work documentation.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.securityhub.FindingAggregator("example", {linkingMode: "ALL_REGIONS"});
const exampleOrganizationConfiguration = new aws.securityhub.OrganizationConfiguration("example", {
autoEnable: false,
autoEnableStandards: "NONE",
organizationConfiguration: {
configurationType: "CENTRAL",
},
}, {
dependsOn: [example],
});
const exampleConfigurationPolicy = new aws.securityhub.ConfigurationPolicy("example", {
name: "Example",
description: "This is an example configuration policy",
configurationPolicy: {
serviceEnabled: true,
enabledStandardArns: [
"arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0",
"arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0",
],
securityControlsConfiguration: {
disabledControlIdentifiers: [],
},
},
}, {
dependsOn: [exampleOrganizationConfiguration],
});
const accountExample = new aws.securityhub.ConfigurationPolicyAssociation("account_example", {
targetId: "123456789012",
policyId: exampleConfigurationPolicy.id,
});
const rootExample = new aws.securityhub.ConfigurationPolicyAssociation("root_example", {
targetId: "r-abcd",
policyId: exampleConfigurationPolicy.id,
});
const ouExample = new aws.securityhub.ConfigurationPolicyAssociation("ou_example", {
targetId: "ou-abcd-12345678",
policyId: exampleConfigurationPolicy.id,
});
import pulumi
import pulumi_aws as aws
example = aws.securityhub.FindingAggregator("example", linking_mode="ALL_REGIONS")
example_organization_configuration = aws.securityhub.OrganizationConfiguration("example",
auto_enable=False,
auto_enable_standards="NONE",
organization_configuration={
"configurationType": "CENTRAL",
},
opts = pulumi.ResourceOptions(depends_on=[example]))
example_configuration_policy = aws.securityhub.ConfigurationPolicy("example",
name="Example",
description="This is an example configuration policy",
configuration_policy={
"serviceEnabled": True,
"enabledStandardArns": [
"arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0",
"arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0",
],
"securityControlsConfiguration": {
"disabledControlIdentifiers": [],
},
},
opts = pulumi.ResourceOptions(depends_on=[example_organization_configuration]))
account_example = aws.securityhub.ConfigurationPolicyAssociation("account_example",
target_id="123456789012",
policy_id=example_configuration_policy.id)
root_example = aws.securityhub.ConfigurationPolicyAssociation("root_example",
target_id="r-abcd",
policy_id=example_configuration_policy.id)
ou_example = aws.securityhub.ConfigurationPolicyAssociation("ou_example",
target_id="ou-abcd-12345678",
policy_id=example_configuration_policy.id)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/securityhub"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := securityhub.NewFindingAggregator(ctx, "example", &securityhub.FindingAggregatorArgs{
LinkingMode: pulumi.String("ALL_REGIONS"),
})
if err != nil {
return err
}
exampleOrganizationConfiguration, err := securityhub.NewOrganizationConfiguration(ctx, "example", &securityhub.OrganizationConfigurationArgs{
AutoEnable: pulumi.Bool(false),
AutoEnableStandards: pulumi.String("NONE"),
OrganizationConfiguration: &securityhub.OrganizationConfigurationOrganizationConfigurationArgs{
ConfigurationType: pulumi.String("CENTRAL"),
},
}, pulumi.DependsOn([]pulumi.Resource{
example,
}))
if err != nil {
return err
}
exampleConfigurationPolicy, err := securityhub.NewConfigurationPolicy(ctx, "example", &securityhub.ConfigurationPolicyArgs{
Name: pulumi.String("Example"),
Description: pulumi.String("This is an example configuration policy"),
ConfigurationPolicy: &securityhub.ConfigurationPolicyConfigurationPolicyArgs{
ServiceEnabled: pulumi.Bool(true),
EnabledStandardArns: pulumi.StringArray{
pulumi.String("arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0"),
pulumi.String("arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0"),
},
SecurityControlsConfiguration: &securityhub.ConfigurationPolicyConfigurationPolicySecurityControlsConfigurationArgs{
DisabledControlIdentifiers: pulumi.StringArray{},
},
},
}, pulumi.DependsOn([]pulumi.Resource{
exampleOrganizationConfiguration,
}))
if err != nil {
return err
}
_, err = securityhub.NewConfigurationPolicyAssociation(ctx, "account_example", &securityhub.ConfigurationPolicyAssociationArgs{
TargetId: pulumi.String("123456789012"),
PolicyId: exampleConfigurationPolicy.ID(),
})
if err != nil {
return err
}
_, err = securityhub.NewConfigurationPolicyAssociation(ctx, "root_example", &securityhub.ConfigurationPolicyAssociationArgs{
TargetId: pulumi.String("r-abcd"),
PolicyId: exampleConfigurationPolicy.ID(),
})
if err != nil {
return err
}
_, err = securityhub.NewConfigurationPolicyAssociation(ctx, "ou_example", &securityhub.ConfigurationPolicyAssociationArgs{
TargetId: pulumi.String("ou-abcd-12345678"),
PolicyId: exampleConfigurationPolicy.ID(),
})
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.SecurityHub.FindingAggregator("example", new()
{
LinkingMode = "ALL_REGIONS",
});
var exampleOrganizationConfiguration = new Aws.SecurityHub.OrganizationConfiguration("example", new()
{
AutoEnable = false,
AutoEnableStandards = "NONE",
OrganizationConfigurationDetails = new Aws.SecurityHub.Inputs.OrganizationConfigurationOrganizationConfigurationArgs
{
ConfigurationType = "CENTRAL",
},
}, new CustomResourceOptions
{
DependsOn =
{
example,
},
});
var exampleConfigurationPolicy = new Aws.SecurityHub.ConfigurationPolicy("example", new()
{
Name = "Example",
Description = "This is an example configuration policy",
ConfigurationPolicyDetails = new Aws.SecurityHub.Inputs.ConfigurationPolicyConfigurationPolicyArgs
{
ServiceEnabled = true,
EnabledStandardArns = new[]
{
"arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0",
"arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0",
},
SecurityControlsConfiguration = new Aws.SecurityHub.Inputs.ConfigurationPolicyConfigurationPolicySecurityControlsConfigurationArgs
{
DisabledControlIdentifiers = new() { },
},
},
}, new CustomResourceOptions
{
DependsOn =
{
exampleOrganizationConfiguration,
},
});
var accountExample = new Aws.SecurityHub.ConfigurationPolicyAssociation("account_example", new()
{
TargetId = "123456789012",
PolicyId = exampleConfigurationPolicy.Id,
});
var rootExample = new Aws.SecurityHub.ConfigurationPolicyAssociation("root_example", new()
{
TargetId = "r-abcd",
PolicyId = exampleConfigurationPolicy.Id,
});
var ouExample = new Aws.SecurityHub.ConfigurationPolicyAssociation("ou_example", new()
{
TargetId = "ou-abcd-12345678",
PolicyId = exampleConfigurationPolicy.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.securityhub.FindingAggregator;
import com.pulumi.aws.securityhub.FindingAggregatorArgs;
import com.pulumi.aws.securityhub.OrganizationConfiguration;
import com.pulumi.aws.securityhub.OrganizationConfigurationArgs;
import com.pulumi.aws.securityhub.inputs.OrganizationConfigurationOrganizationConfigurationArgs;
import com.pulumi.aws.securityhub.ConfigurationPolicy;
import com.pulumi.aws.securityhub.ConfigurationPolicyArgs;
import com.pulumi.aws.securityhub.inputs.ConfigurationPolicyConfigurationPolicyArgs;
import com.pulumi.aws.securityhub.inputs.ConfigurationPolicyConfigurationPolicySecurityControlsConfigurationArgs;
import com.pulumi.aws.securityhub.ConfigurationPolicyAssociation;
import com.pulumi.aws.securityhub.ConfigurationPolicyAssociationArgs;
import com.pulumi.resources.CustomResourceOptions;
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 FindingAggregator("example", FindingAggregatorArgs.builder()
.linkingMode("ALL_REGIONS")
.build());
var exampleOrganizationConfiguration = new OrganizationConfiguration("exampleOrganizationConfiguration", OrganizationConfigurationArgs.builder()
.autoEnable(false)
.autoEnableStandards("NONE")
.organizationConfiguration(OrganizationConfigurationOrganizationConfigurationArgs.builder()
.configurationType("CENTRAL")
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(example)
.build());
var exampleConfigurationPolicy = new ConfigurationPolicy("exampleConfigurationPolicy", ConfigurationPolicyArgs.builder()
.name("Example")
.description("This is an example configuration policy")
.configurationPolicy(ConfigurationPolicyConfigurationPolicyArgs.builder()
.serviceEnabled(true)
.enabledStandardArns(
"arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0",
"arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0")
.securityControlsConfiguration(ConfigurationPolicyConfigurationPolicySecurityControlsConfigurationArgs.builder()
.disabledControlIdentifiers()
.build())
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(exampleOrganizationConfiguration)
.build());
var accountExample = new ConfigurationPolicyAssociation("accountExample", ConfigurationPolicyAssociationArgs.builder()
.targetId("123456789012")
.policyId(exampleConfigurationPolicy.id())
.build());
var rootExample = new ConfigurationPolicyAssociation("rootExample", ConfigurationPolicyAssociationArgs.builder()
.targetId("r-abcd")
.policyId(exampleConfigurationPolicy.id())
.build());
var ouExample = new ConfigurationPolicyAssociation("ouExample", ConfigurationPolicyAssociationArgs.builder()
.targetId("ou-abcd-12345678")
.policyId(exampleConfigurationPolicy.id())
.build());
}
}
resources:
example:
type: aws:securityhub:FindingAggregator
properties:
linkingMode: ALL_REGIONS
exampleOrganizationConfiguration:
type: aws:securityhub:OrganizationConfiguration
name: example
properties:
autoEnable: false
autoEnableStandards: NONE
organizationConfiguration:
configurationType: CENTRAL
options:
dependson:
- ${example}
exampleConfigurationPolicy:
type: aws:securityhub:ConfigurationPolicy
name: example
properties:
name: Example
description: This is an example configuration policy
configurationPolicy:
serviceEnabled: true
enabledStandardArns:
- arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0
- arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0
securityControlsConfiguration:
disabledControlIdentifiers: []
options:
dependson:
- ${exampleOrganizationConfiguration}
accountExample:
type: aws:securityhub:ConfigurationPolicyAssociation
name: account_example
properties:
targetId: '123456789012'
policyId: ${exampleConfigurationPolicy.id}
rootExample:
type: aws:securityhub:ConfigurationPolicyAssociation
name: root_example
properties:
targetId: r-abcd
policyId: ${exampleConfigurationPolicy.id}
ouExample:
type: aws:securityhub:ConfigurationPolicyAssociation
name: ou_example
properties:
targetId: ou-abcd-12345678
policyId: ${exampleConfigurationPolicy.id}
Create ConfigurationPolicyAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ConfigurationPolicyAssociation(name: string, args: ConfigurationPolicyAssociationArgs, opts?: CustomResourceOptions);
@overload
def ConfigurationPolicyAssociation(resource_name: str,
args: ConfigurationPolicyAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ConfigurationPolicyAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
policy_id: Optional[str] = None,
target_id: Optional[str] = None)
func NewConfigurationPolicyAssociation(ctx *Context, name string, args ConfigurationPolicyAssociationArgs, opts ...ResourceOption) (*ConfigurationPolicyAssociation, error)
public ConfigurationPolicyAssociation(string name, ConfigurationPolicyAssociationArgs args, CustomResourceOptions? opts = null)
public ConfigurationPolicyAssociation(String name, ConfigurationPolicyAssociationArgs args)
public ConfigurationPolicyAssociation(String name, ConfigurationPolicyAssociationArgs args, CustomResourceOptions options)
type: aws:securityhub:ConfigurationPolicyAssociation
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 ConfigurationPolicyAssociationArgs
- 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 ConfigurationPolicyAssociationArgs
- 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 ConfigurationPolicyAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ConfigurationPolicyAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ConfigurationPolicyAssociationArgs
- 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 configurationPolicyAssociationResource = new Aws.SecurityHub.ConfigurationPolicyAssociation("configurationPolicyAssociationResource", new()
{
PolicyId = "string",
TargetId = "string",
});
example, err := securityhub.NewConfigurationPolicyAssociation(ctx, "configurationPolicyAssociationResource", &securityhub.ConfigurationPolicyAssociationArgs{
PolicyId: pulumi.String("string"),
TargetId: pulumi.String("string"),
})
var configurationPolicyAssociationResource = new ConfigurationPolicyAssociation("configurationPolicyAssociationResource", ConfigurationPolicyAssociationArgs.builder()
.policyId("string")
.targetId("string")
.build());
configuration_policy_association_resource = aws.securityhub.ConfigurationPolicyAssociation("configurationPolicyAssociationResource",
policy_id="string",
target_id="string")
const configurationPolicyAssociationResource = new aws.securityhub.ConfigurationPolicyAssociation("configurationPolicyAssociationResource", {
policyId: "string",
targetId: "string",
});
type: aws:securityhub:ConfigurationPolicyAssociation
properties:
policyId: string
targetId: string
ConfigurationPolicyAssociation 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 ConfigurationPolicyAssociation resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ConfigurationPolicyAssociation 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 ConfigurationPolicyAssociation Resource
Get an existing ConfigurationPolicyAssociation 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?: ConfigurationPolicyAssociationState, opts?: CustomResourceOptions): ConfigurationPolicyAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
policy_id: Optional[str] = None,
target_id: Optional[str] = None) -> ConfigurationPolicyAssociation
func GetConfigurationPolicyAssociation(ctx *Context, name string, id IDInput, state *ConfigurationPolicyAssociationState, opts ...ResourceOption) (*ConfigurationPolicyAssociation, error)
public static ConfigurationPolicyAssociation Get(string name, Input<string> id, ConfigurationPolicyAssociationState? state, CustomResourceOptions? opts = null)
public static ConfigurationPolicyAssociation get(String name, Output<String> id, ConfigurationPolicyAssociationState 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 an existing Security Hub enabled account using the target id. For example:
$ pulumi import aws:securityhub/configurationPolicyAssociation:ConfigurationPolicyAssociation example_account_association 123456789012
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.
Try AWS Native preview for resources not in the classic version.