1. Packages
  2. Incapsula Provider
  3. API Docs
  4. PolicyAssetAssociation
incapsula 3.33.0 published on Wednesday, Apr 30, 2025 by imperva

incapsula.PolicyAssetAssociation

Explore with Pulumi AI

incapsula logo
incapsula 3.33.0 published on Wednesday, Apr 30, 2025 by imperva

    Provides an Incapsula Policy Asset Association resource. This resource enables you to apply existing policies to assets in your account.

    Dependency is on existing policies, created using the incapsula.Policy resource.

    To simplify the use of policies, you can utilize this cloud-waf Module along with its submodules.

    For full feature documentation, see Create and Manage Policies.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as incapsula from "@pulumi/incapsula";
    
    const example_policy_asset_association = new incapsula.PolicyAssetAssociation("example-policy-asset-association", {
        policyId: incapsula_policy["example-policy"].id,
        assetId: incapsula_site["example-site-dns"].id,
        assetType: "WEBSITE",
    });
    
    import pulumi
    import pulumi_incapsula as incapsula
    
    example_policy_asset_association = incapsula.PolicyAssetAssociation("example-policy-asset-association",
        policy_id=incapsula_policy["example-policy"]["id"],
        asset_id=incapsula_site["example-site-dns"]["id"],
        asset_type="WEBSITE")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/incapsula/v3/incapsula"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := incapsula.NewPolicyAssetAssociation(ctx, "example-policy-asset-association", &incapsula.PolicyAssetAssociationArgs{
    			PolicyId:  pulumi.Any(incapsula_policy.ExamplePolicy.Id),
    			AssetId:   pulumi.Any(incapsula_site.ExampleSiteDns.Id),
    			AssetType: pulumi.String("WEBSITE"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Incapsula = Pulumi.Incapsula;
    
    return await Deployment.RunAsync(() => 
    {
        var example_policy_asset_association = new Incapsula.PolicyAssetAssociation("example-policy-asset-association", new()
        {
            PolicyId = incapsula_policy.Example_policy.Id,
            AssetId = incapsula_site.Example_site_dns.Id,
            AssetType = "WEBSITE",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.incapsula.PolicyAssetAssociation;
    import com.pulumi.incapsula.PolicyAssetAssociationArgs;
    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_policy_asset_association = new PolicyAssetAssociation("example-policy-asset-association", PolicyAssetAssociationArgs.builder()
                .policyId(incapsula_policy.example-policy().id())
                .assetId(incapsula_site.example-site-dns().id())
                .assetType("WEBSITE")
                .build());
    
        }
    }
    
    resources:
      example-policy-asset-association:
        type: incapsula:PolicyAssetAssociation
        properties:
          policyId: ${incapsula_policy"example-policy"[%!s(MISSING)].id}
          assetId: ${incapsula_site"example-site-dns"[%!s(MISSING)].id}
          assetType: WEBSITE
    

    Create PolicyAssetAssociation Resource

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

    Constructor syntax

    new PolicyAssetAssociation(name: string, args: PolicyAssetAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def PolicyAssetAssociation(resource_name: str,
                               args: PolicyAssetAssociationArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def PolicyAssetAssociation(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               asset_id: Optional[str] = None,
                               asset_type: Optional[str] = None,
                               policy_id: Optional[str] = None,
                               account_id: Optional[float] = None,
                               policy_asset_association_id: Optional[str] = None)
    func NewPolicyAssetAssociation(ctx *Context, name string, args PolicyAssetAssociationArgs, opts ...ResourceOption) (*PolicyAssetAssociation, error)
    public PolicyAssetAssociation(string name, PolicyAssetAssociationArgs args, CustomResourceOptions? opts = null)
    public PolicyAssetAssociation(String name, PolicyAssetAssociationArgs args)
    public PolicyAssetAssociation(String name, PolicyAssetAssociationArgs args, CustomResourceOptions options)
    
    type: incapsula:PolicyAssetAssociation
    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 PolicyAssetAssociationArgs
    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 PolicyAssetAssociationArgs
    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 PolicyAssetAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PolicyAssetAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PolicyAssetAssociationArgs
    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 policyAssetAssociationResource = new Incapsula.PolicyAssetAssociation("policyAssetAssociationResource", new()
    {
        AssetId = "string",
        AssetType = "string",
        PolicyId = "string",
        AccountId = 0,
        PolicyAssetAssociationId = "string",
    });
    
    example, err := incapsula.NewPolicyAssetAssociation(ctx, "policyAssetAssociationResource", &incapsula.PolicyAssetAssociationArgs{
    	AssetId:                  pulumi.String("string"),
    	AssetType:                pulumi.String("string"),
    	PolicyId:                 pulumi.String("string"),
    	AccountId:                pulumi.Float64(0),
    	PolicyAssetAssociationId: pulumi.String("string"),
    })
    
    var policyAssetAssociationResource = new PolicyAssetAssociation("policyAssetAssociationResource", PolicyAssetAssociationArgs.builder()
        .assetId("string")
        .assetType("string")
        .policyId("string")
        .accountId(0)
        .policyAssetAssociationId("string")
        .build());
    
    policy_asset_association_resource = incapsula.PolicyAssetAssociation("policyAssetAssociationResource",
        asset_id="string",
        asset_type="string",
        policy_id="string",
        account_id=0,
        policy_asset_association_id="string")
    
    const policyAssetAssociationResource = new incapsula.PolicyAssetAssociation("policyAssetAssociationResource", {
        assetId: "string",
        assetType: "string",
        policyId: "string",
        accountId: 0,
        policyAssetAssociationId: "string",
    });
    
    type: incapsula:PolicyAssetAssociation
    properties:
        accountId: 0
        assetId: string
        assetType: string
        policyAssetAssociationId: string
        policyId: string
    

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

    AssetId string
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    AssetType string
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    PolicyId string
    The Policy ID for the asset association.
    AccountId double
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    PolicyAssetAssociationId string
    Unique identifier in the API for the policy asset association.
    AssetId string
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    AssetType string
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    PolicyId string
    The Policy ID for the asset association.
    AccountId float64
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    PolicyAssetAssociationId string
    Unique identifier in the API for the policy asset association.
    assetId String
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    assetType String
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    policyId String
    The Policy ID for the asset association.
    accountId Double
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    policyAssetAssociationId String
    Unique identifier in the API for the policy asset association.
    assetId string
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    assetType string
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    policyId string
    The Policy ID for the asset association.
    accountId number
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    policyAssetAssociationId string
    Unique identifier in the API for the policy asset association.
    asset_id str
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    asset_type str
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    policy_id str
    The Policy ID for the asset association.
    account_id float
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    policy_asset_association_id str
    Unique identifier in the API for the policy asset association.
    assetId String
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    assetType String
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    policyId String
    The Policy ID for the asset association.
    accountId Number
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    policyAssetAssociationId String
    Unique identifier in the API for the policy asset association.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the PolicyAssetAssociation 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 PolicyAssetAssociation Resource

    Get an existing PolicyAssetAssociation 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?: PolicyAssetAssociationState, opts?: CustomResourceOptions): PolicyAssetAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[float] = None,
            asset_id: Optional[str] = None,
            asset_type: Optional[str] = None,
            policy_asset_association_id: Optional[str] = None,
            policy_id: Optional[str] = None) -> PolicyAssetAssociation
    func GetPolicyAssetAssociation(ctx *Context, name string, id IDInput, state *PolicyAssetAssociationState, opts ...ResourceOption) (*PolicyAssetAssociation, error)
    public static PolicyAssetAssociation Get(string name, Input<string> id, PolicyAssetAssociationState? state, CustomResourceOptions? opts = null)
    public static PolicyAssetAssociation get(String name, Output<String> id, PolicyAssetAssociationState state, CustomResourceOptions options)
    resources:  _:    type: incapsula:PolicyAssetAssociation    get:      id: ${id}
    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:
    AccountId double
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    AssetId string
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    AssetType string
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    PolicyAssetAssociationId string
    Unique identifier in the API for the policy asset association.
    PolicyId string
    The Policy ID for the asset association.
    AccountId float64
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    AssetId string
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    AssetType string
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    PolicyAssetAssociationId string
    Unique identifier in the API for the policy asset association.
    PolicyId string
    The Policy ID for the asset association.
    accountId Double
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    assetId String
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    assetType String
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    policyAssetAssociationId String
    Unique identifier in the API for the policy asset association.
    policyId String
    The Policy ID for the asset association.
    accountId number
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    assetId string
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    assetType string
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    policyAssetAssociationId string
    Unique identifier in the API for the policy asset association.
    policyId string
    The Policy ID for the asset association.
    account_id float
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    asset_id str
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    asset_type str
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    policy_asset_association_id str
    Unique identifier in the API for the policy asset association.
    policy_id str
    The Policy ID for the asset association.
    accountId Number
    The account ID of the asset. Set this field if the asset's account is different than the account used in the credentials. For example, when setting a sub account’s asset association from the parent account.
    assetId String
    The Asset ID for the asset association. Only type of asset supported at the moment is site.
    assetType String
    The Policy type for the asset association. Only value at the moment is WEBSITE.
    policyAssetAssociationId String
    Unique identifier in the API for the policy asset association.
    policyId String
    The Policy ID for the asset association.

    Import

    Policy can be imported using the policy_id, asset_id and asset_type e.g.:

    $ pulumi import incapsula:index/policyAssetAssociation:PolicyAssetAssociation example-policy-asset-association policy_id/asset_id/asset_type
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    incapsula imperva/terraform-provider-incapsula
    License
    Notes
    This Pulumi package is based on the incapsula Terraform Provider.
    incapsula logo
    incapsula 3.33.0 published on Wednesday, Apr 30, 2025 by imperva