1. Packages
  2. Cloudflare
  3. API Docs
  4. ApiToken
Cloudflare v5.31.0 published on Wednesday, Jun 12, 2024 by Pulumi

cloudflare.ApiToken

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.31.0 published on Wednesday, Jun 12, 2024 by Pulumi

    Provides a resource which manages Cloudflare API tokens.

    Read more about permission groups and their applicable scopes in the developer documentation.

    Create ApiToken Resource

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

    Constructor syntax

    new ApiToken(name: string, args: ApiTokenArgs, opts?: CustomResourceOptions);
    @overload
    def ApiToken(resource_name: str,
                 args: ApiTokenArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApiToken(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 name: Optional[str] = None,
                 policies: Optional[Sequence[ApiTokenPolicyArgs]] = None,
                 condition: Optional[ApiTokenConditionArgs] = None,
                 expires_on: Optional[str] = None,
                 not_before: Optional[str] = None)
    func NewApiToken(ctx *Context, name string, args ApiTokenArgs, opts ...ResourceOption) (*ApiToken, error)
    public ApiToken(string name, ApiTokenArgs args, CustomResourceOptions? opts = null)
    public ApiToken(String name, ApiTokenArgs args)
    public ApiToken(String name, ApiTokenArgs args, CustomResourceOptions options)
    
    type: cloudflare:ApiToken
    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 ApiTokenArgs
    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 ApiTokenArgs
    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 ApiTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApiTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApiTokenArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var apiTokenResource = new Cloudflare.ApiToken("apiTokenResource", new()
    {
        Name = "string",
        Policies = new[]
        {
            new Cloudflare.Inputs.ApiTokenPolicyArgs
            {
                PermissionGroups = new[]
                {
                    "string",
                },
                Resources = 
                {
                    { "string", "string" },
                },
                Effect = "string",
            },
        },
        Condition = new Cloudflare.Inputs.ApiTokenConditionArgs
        {
            RequestIp = new Cloudflare.Inputs.ApiTokenConditionRequestIpArgs
            {
                Ins = new[]
                {
                    "string",
                },
                NotIns = new[]
                {
                    "string",
                },
            },
        },
        ExpiresOn = "string",
        NotBefore = "string",
    });
    
    example, err := cloudflare.NewApiToken(ctx, "apiTokenResource", &cloudflare.ApiTokenArgs{
    	Name: pulumi.String("string"),
    	Policies: cloudflare.ApiTokenPolicyArray{
    		&cloudflare.ApiTokenPolicyArgs{
    			PermissionGroups: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			Resources: pulumi.StringMap{
    				"string": pulumi.String("string"),
    			},
    			Effect: pulumi.String("string"),
    		},
    	},
    	Condition: &cloudflare.ApiTokenConditionArgs{
    		RequestIp: &cloudflare.ApiTokenConditionRequestIpArgs{
    			Ins: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			NotIns: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    		},
    	},
    	ExpiresOn: pulumi.String("string"),
    	NotBefore: pulumi.String("string"),
    })
    
    var apiTokenResource = new ApiToken("apiTokenResource", ApiTokenArgs.builder()
        .name("string")
        .policies(ApiTokenPolicyArgs.builder()
            .permissionGroups("string")
            .resources(Map.of("string", "string"))
            .effect("string")
            .build())
        .condition(ApiTokenConditionArgs.builder()
            .requestIp(ApiTokenConditionRequestIpArgs.builder()
                .ins("string")
                .notIns("string")
                .build())
            .build())
        .expiresOn("string")
        .notBefore("string")
        .build());
    
    api_token_resource = cloudflare.ApiToken("apiTokenResource",
        name="string",
        policies=[cloudflare.ApiTokenPolicyArgs(
            permission_groups=["string"],
            resources={
                "string": "string",
            },
            effect="string",
        )],
        condition=cloudflare.ApiTokenConditionArgs(
            request_ip=cloudflare.ApiTokenConditionRequestIpArgs(
                ins=["string"],
                not_ins=["string"],
            ),
        ),
        expires_on="string",
        not_before="string")
    
    const apiTokenResource = new cloudflare.ApiToken("apiTokenResource", {
        name: "string",
        policies: [{
            permissionGroups: ["string"],
            resources: {
                string: "string",
            },
            effect: "string",
        }],
        condition: {
            requestIp: {
                ins: ["string"],
                notIns: ["string"],
            },
        },
        expiresOn: "string",
        notBefore: "string",
    });
    
    type: cloudflare:ApiToken
    properties:
        condition:
            requestIp:
                ins:
                    - string
                notIns:
                    - string
        expiresOn: string
        name: string
        notBefore: string
        policies:
            - effect: string
              permissionGroups:
                - string
              resources:
                string: string
    

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

    Name string
    Name of the API Token.
    Policies List<ApiTokenPolicy>
    Permissions policy. Multiple policy blocks can be defined.
    Condition ApiTokenCondition
    Conditions under which the token should be considered valid.
    ExpiresOn string
    The expiration time on or after which the token MUST NOT be accepted for processing.
    NotBefore string
    The time before which the token MUST NOT be accepted for processing.
    Name string
    Name of the API Token.
    Policies []ApiTokenPolicyArgs
    Permissions policy. Multiple policy blocks can be defined.
    Condition ApiTokenConditionArgs
    Conditions under which the token should be considered valid.
    ExpiresOn string
    The expiration time on or after which the token MUST NOT be accepted for processing.
    NotBefore string
    The time before which the token MUST NOT be accepted for processing.
    name String
    Name of the API Token.
    policies List<ApiTokenPolicy>
    Permissions policy. Multiple policy blocks can be defined.
    condition ApiTokenCondition
    Conditions under which the token should be considered valid.
    expiresOn String
    The expiration time on or after which the token MUST NOT be accepted for processing.
    notBefore String
    The time before which the token MUST NOT be accepted for processing.
    name string
    Name of the API Token.
    policies ApiTokenPolicy[]
    Permissions policy. Multiple policy blocks can be defined.
    condition ApiTokenCondition
    Conditions under which the token should be considered valid.
    expiresOn string
    The expiration time on or after which the token MUST NOT be accepted for processing.
    notBefore string
    The time before which the token MUST NOT be accepted for processing.
    name str
    Name of the API Token.
    policies Sequence[ApiTokenPolicyArgs]
    Permissions policy. Multiple policy blocks can be defined.
    condition ApiTokenConditionArgs
    Conditions under which the token should be considered valid.
    expires_on str
    The expiration time on or after which the token MUST NOT be accepted for processing.
    not_before str
    The time before which the token MUST NOT be accepted for processing.
    name String
    Name of the API Token.
    policies List<Property Map>
    Permissions policy. Multiple policy blocks can be defined.
    condition Property Map
    Conditions under which the token should be considered valid.
    expiresOn String
    The expiration time on or after which the token MUST NOT be accepted for processing.
    notBefore String
    The time before which the token MUST NOT be accepted for processing.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    IssuedOn string
    Timestamp of when the token was issued.
    ModifiedOn string
    Timestamp of when the token was last modified.
    Status string
    Value string
    The value of the API Token.
    Id string
    The provider-assigned unique ID for this managed resource.
    IssuedOn string
    Timestamp of when the token was issued.
    ModifiedOn string
    Timestamp of when the token was last modified.
    Status string
    Value string
    The value of the API Token.
    id String
    The provider-assigned unique ID for this managed resource.
    issuedOn String
    Timestamp of when the token was issued.
    modifiedOn String
    Timestamp of when the token was last modified.
    status String
    value String
    The value of the API Token.
    id string
    The provider-assigned unique ID for this managed resource.
    issuedOn string
    Timestamp of when the token was issued.
    modifiedOn string
    Timestamp of when the token was last modified.
    status string
    value string
    The value of the API Token.
    id str
    The provider-assigned unique ID for this managed resource.
    issued_on str
    Timestamp of when the token was issued.
    modified_on str
    Timestamp of when the token was last modified.
    status str
    value str
    The value of the API Token.
    id String
    The provider-assigned unique ID for this managed resource.
    issuedOn String
    Timestamp of when the token was issued.
    modifiedOn String
    Timestamp of when the token was last modified.
    status String
    value String
    The value of the API Token.

    Look up Existing ApiToken Resource

    Get an existing ApiToken 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?: ApiTokenState, opts?: CustomResourceOptions): ApiToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            condition: Optional[ApiTokenConditionArgs] = None,
            expires_on: Optional[str] = None,
            issued_on: Optional[str] = None,
            modified_on: Optional[str] = None,
            name: Optional[str] = None,
            not_before: Optional[str] = None,
            policies: Optional[Sequence[ApiTokenPolicyArgs]] = None,
            status: Optional[str] = None,
            value: Optional[str] = None) -> ApiToken
    func GetApiToken(ctx *Context, name string, id IDInput, state *ApiTokenState, opts ...ResourceOption) (*ApiToken, error)
    public static ApiToken Get(string name, Input<string> id, ApiTokenState? state, CustomResourceOptions? opts = null)
    public static ApiToken get(String name, Output<String> id, ApiTokenState 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:
    Condition ApiTokenCondition
    Conditions under which the token should be considered valid.
    ExpiresOn string
    The expiration time on or after which the token MUST NOT be accepted for processing.
    IssuedOn string
    Timestamp of when the token was issued.
    ModifiedOn string
    Timestamp of when the token was last modified.
    Name string
    Name of the API Token.
    NotBefore string
    The time before which the token MUST NOT be accepted for processing.
    Policies List<ApiTokenPolicy>
    Permissions policy. Multiple policy blocks can be defined.
    Status string
    Value string
    The value of the API Token.
    Condition ApiTokenConditionArgs
    Conditions under which the token should be considered valid.
    ExpiresOn string
    The expiration time on or after which the token MUST NOT be accepted for processing.
    IssuedOn string
    Timestamp of when the token was issued.
    ModifiedOn string
    Timestamp of when the token was last modified.
    Name string
    Name of the API Token.
    NotBefore string
    The time before which the token MUST NOT be accepted for processing.
    Policies []ApiTokenPolicyArgs
    Permissions policy. Multiple policy blocks can be defined.
    Status string
    Value string
    The value of the API Token.
    condition ApiTokenCondition
    Conditions under which the token should be considered valid.
    expiresOn String
    The expiration time on or after which the token MUST NOT be accepted for processing.
    issuedOn String
    Timestamp of when the token was issued.
    modifiedOn String
    Timestamp of when the token was last modified.
    name String
    Name of the API Token.
    notBefore String
    The time before which the token MUST NOT be accepted for processing.
    policies List<ApiTokenPolicy>
    Permissions policy. Multiple policy blocks can be defined.
    status String
    value String
    The value of the API Token.
    condition ApiTokenCondition
    Conditions under which the token should be considered valid.
    expiresOn string
    The expiration time on or after which the token MUST NOT be accepted for processing.
    issuedOn string
    Timestamp of when the token was issued.
    modifiedOn string
    Timestamp of when the token was last modified.
    name string
    Name of the API Token.
    notBefore string
    The time before which the token MUST NOT be accepted for processing.
    policies ApiTokenPolicy[]
    Permissions policy. Multiple policy blocks can be defined.
    status string
    value string
    The value of the API Token.
    condition ApiTokenConditionArgs
    Conditions under which the token should be considered valid.
    expires_on str
    The expiration time on or after which the token MUST NOT be accepted for processing.
    issued_on str
    Timestamp of when the token was issued.
    modified_on str
    Timestamp of when the token was last modified.
    name str
    Name of the API Token.
    not_before str
    The time before which the token MUST NOT be accepted for processing.
    policies Sequence[ApiTokenPolicyArgs]
    Permissions policy. Multiple policy blocks can be defined.
    status str
    value str
    The value of the API Token.
    condition Property Map
    Conditions under which the token should be considered valid.
    expiresOn String
    The expiration time on or after which the token MUST NOT be accepted for processing.
    issuedOn String
    Timestamp of when the token was issued.
    modifiedOn String
    Timestamp of when the token was last modified.
    name String
    Name of the API Token.
    notBefore String
    The time before which the token MUST NOT be accepted for processing.
    policies List<Property Map>
    Permissions policy. Multiple policy blocks can be defined.
    status String
    value String
    The value of the API Token.

    Supporting Types

    ApiTokenCondition, ApiTokenConditionArgs

    RequestIp ApiTokenConditionRequestIp
    Request IP related conditions.
    RequestIp ApiTokenConditionRequestIp
    Request IP related conditions.
    requestIp ApiTokenConditionRequestIp
    Request IP related conditions.
    requestIp ApiTokenConditionRequestIp
    Request IP related conditions.
    request_ip ApiTokenConditionRequestIp
    Request IP related conditions.
    requestIp Property Map
    Request IP related conditions.

    ApiTokenConditionRequestIp, ApiTokenConditionRequestIpArgs

    Ins List<string>
    List of IP addresses or CIDR notation where the token may be used from. If not specified, the token will be valid for all IP addresses.
    NotIns List<string>
    List of IP addresses or CIDR notation where the token should not be used from.
    Ins []string
    List of IP addresses or CIDR notation where the token may be used from. If not specified, the token will be valid for all IP addresses.
    NotIns []string
    List of IP addresses or CIDR notation where the token should not be used from.
    ins List<String>
    List of IP addresses or CIDR notation where the token may be used from. If not specified, the token will be valid for all IP addresses.
    notIns List<String>
    List of IP addresses or CIDR notation where the token should not be used from.
    ins string[]
    List of IP addresses or CIDR notation where the token may be used from. If not specified, the token will be valid for all IP addresses.
    notIns string[]
    List of IP addresses or CIDR notation where the token should not be used from.
    ins Sequence[str]
    List of IP addresses or CIDR notation where the token may be used from. If not specified, the token will be valid for all IP addresses.
    not_ins Sequence[str]
    List of IP addresses or CIDR notation where the token should not be used from.
    ins List<String>
    List of IP addresses or CIDR notation where the token may be used from. If not specified, the token will be valid for all IP addresses.
    notIns List<String>
    List of IP addresses or CIDR notation where the token should not be used from.

    ApiTokenPolicy, ApiTokenPolicyArgs

    PermissionGroups List<string>
    List of permissions groups IDs. See documentation for more information.
    Resources Dictionary<string, string>
    Describes what operations against which resources are allowed or denied.
    Effect string
    Effect of the policy. Available values: allow, deny. Defaults to allow.
    PermissionGroups []string
    List of permissions groups IDs. See documentation for more information.
    Resources map[string]string
    Describes what operations against which resources are allowed or denied.
    Effect string
    Effect of the policy. Available values: allow, deny. Defaults to allow.
    permissionGroups List<String>
    List of permissions groups IDs. See documentation for more information.
    resources Map<String,String>
    Describes what operations against which resources are allowed or denied.
    effect String
    Effect of the policy. Available values: allow, deny. Defaults to allow.
    permissionGroups string[]
    List of permissions groups IDs. See documentation for more information.
    resources {[key: string]: string}
    Describes what operations against which resources are allowed or denied.
    effect string
    Effect of the policy. Available values: allow, deny. Defaults to allow.
    permission_groups Sequence[str]
    List of permissions groups IDs. See documentation for more information.
    resources Mapping[str, str]
    Describes what operations against which resources are allowed or denied.
    effect str
    Effect of the policy. Available values: allow, deny. Defaults to allow.
    permissionGroups List<String>
    List of permissions groups IDs. See documentation for more information.
    resources Map<String>
    Describes what operations against which resources are allowed or denied.
    effect String
    Effect of the policy. Available values: allow, deny. Defaults to allow.

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v5.31.0 published on Wednesday, Jun 12, 2024 by Pulumi