cloudflare.ApiToken
Explore with Pulumi AI
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.
Constructor 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=[{
"permission_groups": ["string"],
"resources": {
"string": "string",
},
"effect": "string",
}],
condition={
"request_ip": {
"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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ApiToken resource accepts the following input properties:
- Name string
- Name of the API Token.
- Policies
List<Api
Token Policy> - Permissions policy. Multiple policy blocks can be defined.
- Condition
Api
Token Condition - Conditions under which the token should be considered valid.
- Expires
On string - The expiration time on or after which the token MUST NOT be accepted for processing.
- Not
Before string - The time before which the token MUST NOT be accepted for processing.
- Name string
- Name of the API Token.
- Policies
[]Api
Token Policy Args - Permissions policy. Multiple policy blocks can be defined.
- Condition
Api
Token Condition Args - Conditions under which the token should be considered valid.
- Expires
On string - The expiration time on or after which the token MUST NOT be accepted for processing.
- Not
Before string - The time before which the token MUST NOT be accepted for processing.
- name String
- Name of the API Token.
- policies
List<Api
Token Policy> - Permissions policy. Multiple policy blocks can be defined.
- condition
Api
Token Condition - Conditions under which the token should be considered valid.
- expires
On String - The expiration time on or after which the token MUST NOT be accepted for processing.
- not
Before String - The time before which the token MUST NOT be accepted for processing.
- name string
- Name of the API Token.
- policies
Api
Token Policy[] - Permissions policy. Multiple policy blocks can be defined.
- condition
Api
Token Condition - Conditions under which the token should be considered valid.
- expires
On string - The expiration time on or after which the token MUST NOT be accepted for processing.
- not
Before string - The time before which the token MUST NOT be accepted for processing.
- name str
- Name of the API Token.
- policies
Sequence[Api
Token Policy Args] - Permissions policy. Multiple policy blocks can be defined.
- condition
Api
Token Condition Args - 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.
- expires
On String - The expiration time on or after which the token MUST NOT be accepted for processing.
- not
Before 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.
- Issued
On string - Timestamp of when the token was issued.
- Modified
On 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.
- Issued
On string - Timestamp of when the token was issued.
- Modified
On 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.
- issued
On String - Timestamp of when the token was issued.
- modified
On 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.
- issued
On string - Timestamp of when the token was issued.
- modified
On 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.
- issued
On String - Timestamp of when the token was issued.
- modified
On 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.
- Condition
Api
Token Condition - Conditions under which the token should be considered valid.
- Expires
On string - The expiration time on or after which the token MUST NOT be accepted for processing.
- Issued
On string - Timestamp of when the token was issued.
- Modified
On string - Timestamp of when the token was last modified.
- Name string
- Name of the API Token.
- Not
Before string - The time before which the token MUST NOT be accepted for processing.
- Policies
List<Api
Token Policy> - Permissions policy. Multiple policy blocks can be defined.
- Status string
- Value string
- The value of the API Token.
- Condition
Api
Token Condition Args - Conditions under which the token should be considered valid.
- Expires
On string - The expiration time on or after which the token MUST NOT be accepted for processing.
- Issued
On string - Timestamp of when the token was issued.
- Modified
On string - Timestamp of when the token was last modified.
- Name string
- Name of the API Token.
- Not
Before string - The time before which the token MUST NOT be accepted for processing.
- Policies
[]Api
Token Policy Args - Permissions policy. Multiple policy blocks can be defined.
- Status string
- Value string
- The value of the API Token.
- condition
Api
Token Condition - Conditions under which the token should be considered valid.
- expires
On String - The expiration time on or after which the token MUST NOT be accepted for processing.
- issued
On String - Timestamp of when the token was issued.
- modified
On String - Timestamp of when the token was last modified.
- name String
- Name of the API Token.
- not
Before String - The time before which the token MUST NOT be accepted for processing.
- policies
List<Api
Token Policy> - Permissions policy. Multiple policy blocks can be defined.
- status String
- value String
- The value of the API Token.
- condition
Api
Token Condition - Conditions under which the token should be considered valid.
- expires
On string - The expiration time on or after which the token MUST NOT be accepted for processing.
- issued
On string - Timestamp of when the token was issued.
- modified
On string - Timestamp of when the token was last modified.
- name string
- Name of the API Token.
- not
Before string - The time before which the token MUST NOT be accepted for processing.
- policies
Api
Token Policy[] - Permissions policy. Multiple policy blocks can be defined.
- status string
- value string
- The value of the API Token.
- condition
Api
Token Condition Args - 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[Api
Token Policy Args] - 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.
- expires
On String - The expiration time on or after which the token MUST NOT be accepted for processing.
- issued
On String - Timestamp of when the token was issued.
- modified
On String - Timestamp of when the token was last modified.
- name String
- Name of the API Token.
- not
Before 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
- Request
Ip ApiToken Condition Request Ip - Request IP related conditions.
- Request
Ip ApiToken Condition Request Ip - Request IP related conditions.
- request
Ip ApiToken Condition Request Ip - Request IP related conditions.
- request
Ip ApiToken Condition Request Ip - Request IP related conditions.
- request_
ip ApiToken Condition Request Ip - Request IP related conditions.
- request
Ip Property Map - Request IP related conditions.
ApiTokenConditionRequestIp, ApiTokenConditionRequestIpArgs
ApiTokenPolicy, ApiTokenPolicyArgs
- Permission
Groups 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 toallow
.
- Permission
Groups []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 toallow
.
- permission
Groups 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 toallow
.
- permission
Groups 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 toallow
.
- 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 toallow
.
- permission
Groups 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 toallow
.
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflare
Terraform Provider.