tencentcloud.TcrTagRetentionRule
Explore with Pulumi AI
Provides a resource to create a tcr tag retention rule.
Example Usage
Create and enable a tcr tag retention rule instance
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const exampleTcrInstance = new tencentcloud.TcrInstance("exampleTcrInstance", {
instanceType: "basic",
deleteBucket: true,
tags: {
createdBy: "terraform",
},
});
const exampleTcrNamespace = new tencentcloud.TcrNamespace("exampleTcrNamespace", {
instanceId: exampleTcrInstance.tcrInstanceId,
isPublic: true,
isAutoScan: true,
isPreventVul: true,
severity: "medium",
cveWhitelistItems: [{
cveId: "cve-xxxxx",
}],
});
const myRule = new tencentcloud.TcrTagRetentionRule("myRule", {
registryId: exampleTcrInstance.tcrInstanceId,
namespaceName: exampleTcrNamespace.name,
retentionRule: {
key: "nDaysSinceLastPush",
value: 2,
},
cronSetting: "daily",
});
import pulumi
import pulumi_tencentcloud as tencentcloud
example_tcr_instance = tencentcloud.TcrInstance("exampleTcrInstance",
instance_type="basic",
delete_bucket=True,
tags={
"createdBy": "terraform",
})
example_tcr_namespace = tencentcloud.TcrNamespace("exampleTcrNamespace",
instance_id=example_tcr_instance.tcr_instance_id,
is_public=True,
is_auto_scan=True,
is_prevent_vul=True,
severity="medium",
cve_whitelist_items=[{
"cve_id": "cve-xxxxx",
}])
my_rule = tencentcloud.TcrTagRetentionRule("myRule",
registry_id=example_tcr_instance.tcr_instance_id,
namespace_name=example_tcr_namespace.name,
retention_rule={
"key": "nDaysSinceLastPush",
"value": 2,
},
cron_setting="daily")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleTcrInstance, err := tencentcloud.NewTcrInstance(ctx, "exampleTcrInstance", &tencentcloud.TcrInstanceArgs{
InstanceType: pulumi.String("basic"),
DeleteBucket: pulumi.Bool(true),
Tags: pulumi.StringMap{
"createdBy": pulumi.String("terraform"),
},
})
if err != nil {
return err
}
exampleTcrNamespace, err := tencentcloud.NewTcrNamespace(ctx, "exampleTcrNamespace", &tencentcloud.TcrNamespaceArgs{
InstanceId: exampleTcrInstance.TcrInstanceId,
IsPublic: pulumi.Bool(true),
IsAutoScan: pulumi.Bool(true),
IsPreventVul: pulumi.Bool(true),
Severity: pulumi.String("medium"),
CveWhitelistItems: tencentcloud.TcrNamespaceCveWhitelistItemArray{
&tencentcloud.TcrNamespaceCveWhitelistItemArgs{
CveId: pulumi.String("cve-xxxxx"),
},
},
})
if err != nil {
return err
}
_, err = tencentcloud.NewTcrTagRetentionRule(ctx, "myRule", &tencentcloud.TcrTagRetentionRuleArgs{
RegistryId: exampleTcrInstance.TcrInstanceId,
NamespaceName: exampleTcrNamespace.Name,
RetentionRule: &tencentcloud.TcrTagRetentionRuleRetentionRuleArgs{
Key: pulumi.String("nDaysSinceLastPush"),
Value: pulumi.Float64(2),
},
CronSetting: pulumi.String("daily"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;
return await Deployment.RunAsync(() =>
{
var exampleTcrInstance = new Tencentcloud.TcrInstance("exampleTcrInstance", new()
{
InstanceType = "basic",
DeleteBucket = true,
Tags =
{
{ "createdBy", "terraform" },
},
});
var exampleTcrNamespace = new Tencentcloud.TcrNamespace("exampleTcrNamespace", new()
{
InstanceId = exampleTcrInstance.TcrInstanceId,
IsPublic = true,
IsAutoScan = true,
IsPreventVul = true,
Severity = "medium",
CveWhitelistItems = new[]
{
new Tencentcloud.Inputs.TcrNamespaceCveWhitelistItemArgs
{
CveId = "cve-xxxxx",
},
},
});
var myRule = new Tencentcloud.TcrTagRetentionRule("myRule", new()
{
RegistryId = exampleTcrInstance.TcrInstanceId,
NamespaceName = exampleTcrNamespace.Name,
RetentionRule = new Tencentcloud.Inputs.TcrTagRetentionRuleRetentionRuleArgs
{
Key = "nDaysSinceLastPush",
Value = 2,
},
CronSetting = "daily",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.TcrInstance;
import com.pulumi.tencentcloud.TcrInstanceArgs;
import com.pulumi.tencentcloud.TcrNamespace;
import com.pulumi.tencentcloud.TcrNamespaceArgs;
import com.pulumi.tencentcloud.inputs.TcrNamespaceCveWhitelistItemArgs;
import com.pulumi.tencentcloud.TcrTagRetentionRule;
import com.pulumi.tencentcloud.TcrTagRetentionRuleArgs;
import com.pulumi.tencentcloud.inputs.TcrTagRetentionRuleRetentionRuleArgs;
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 exampleTcrInstance = new TcrInstance("exampleTcrInstance", TcrInstanceArgs.builder()
.instanceType("basic")
.deleteBucket(true)
.tags(Map.of("createdBy", "terraform"))
.build());
var exampleTcrNamespace = new TcrNamespace("exampleTcrNamespace", TcrNamespaceArgs.builder()
.instanceId(exampleTcrInstance.tcrInstanceId())
.isPublic(true)
.isAutoScan(true)
.isPreventVul(true)
.severity("medium")
.cveWhitelistItems(TcrNamespaceCveWhitelistItemArgs.builder()
.cveId("cve-xxxxx")
.build())
.build());
var myRule = new TcrTagRetentionRule("myRule", TcrTagRetentionRuleArgs.builder()
.registryId(exampleTcrInstance.tcrInstanceId())
.namespaceName(exampleTcrNamespace.name())
.retentionRule(TcrTagRetentionRuleRetentionRuleArgs.builder()
.key("nDaysSinceLastPush")
.value(2)
.build())
.cronSetting("daily")
.build());
}
}
resources:
exampleTcrInstance:
type: tencentcloud:TcrInstance
properties:
instanceType: basic
deleteBucket: true
tags:
createdBy: terraform
exampleTcrNamespace:
type: tencentcloud:TcrNamespace
properties:
instanceId: ${exampleTcrInstance.tcrInstanceId}
isPublic: true
isAutoScan: true
isPreventVul: true
severity: medium
cveWhitelistItems:
- cveId: cve-xxxxx
myRule:
type: tencentcloud:TcrTagRetentionRule
properties:
registryId: ${exampleTcrInstance.tcrInstanceId}
namespaceName: ${exampleTcrNamespace.name}
retentionRule:
key: nDaysSinceLastPush
value: 2
cronSetting: daily
Create TcrTagRetentionRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new TcrTagRetentionRule(name: string, args: TcrTagRetentionRuleArgs, opts?: CustomResourceOptions);
@overload
def TcrTagRetentionRule(resource_name: str,
args: TcrTagRetentionRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def TcrTagRetentionRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
cron_setting: Optional[str] = None,
namespace_name: Optional[str] = None,
registry_id: Optional[str] = None,
retention_rule: Optional[TcrTagRetentionRuleRetentionRuleArgs] = None,
disabled: Optional[bool] = None,
tcr_tag_retention_rule_id: Optional[str] = None)
func NewTcrTagRetentionRule(ctx *Context, name string, args TcrTagRetentionRuleArgs, opts ...ResourceOption) (*TcrTagRetentionRule, error)
public TcrTagRetentionRule(string name, TcrTagRetentionRuleArgs args, CustomResourceOptions? opts = null)
public TcrTagRetentionRule(String name, TcrTagRetentionRuleArgs args)
public TcrTagRetentionRule(String name, TcrTagRetentionRuleArgs args, CustomResourceOptions options)
type: tencentcloud:TcrTagRetentionRule
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 TcrTagRetentionRuleArgs
- 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 TcrTagRetentionRuleArgs
- 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 TcrTagRetentionRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TcrTagRetentionRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TcrTagRetentionRuleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
TcrTagRetentionRule 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 TcrTagRetentionRule resource accepts the following input properties:
- Cron
Setting string - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- Namespace
Name string - The Name of the namespace.
- Registry
Id string - The main instance ID.
- Retention
Rule TcrTag Retention Rule Retention Rule - Retention Policy.
- Disabled bool
- Whether to disable the rule, with the default value of false.
- Tcr
Tag stringRetention Rule Id - ID of the resource.
- Cron
Setting string - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- Namespace
Name string - The Name of the namespace.
- Registry
Id string - The main instance ID.
- Retention
Rule TcrTag Retention Rule Retention Rule Args - Retention Policy.
- Disabled bool
- Whether to disable the rule, with the default value of false.
- Tcr
Tag stringRetention Rule Id - ID of the resource.
- cron
Setting String - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- namespace
Name String - The Name of the namespace.
- registry
Id String - The main instance ID.
- retention
Rule TcrTag Retention Rule Retention Rule - Retention Policy.
- disabled Boolean
- Whether to disable the rule, with the default value of false.
- tcr
Tag StringRetention Rule Id - ID of the resource.
- cron
Setting string - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- namespace
Name string - The Name of the namespace.
- registry
Id string - The main instance ID.
- retention
Rule TcrTag Retention Rule Retention Rule - Retention Policy.
- disabled boolean
- Whether to disable the rule, with the default value of false.
- tcr
Tag stringRetention Rule Id - ID of the resource.
- cron_
setting str - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- namespace_
name str - The Name of the namespace.
- registry_
id str - The main instance ID.
- retention_
rule TcrTag Retention Rule Retention Rule Args - Retention Policy.
- disabled bool
- Whether to disable the rule, with the default value of false.
- tcr_
tag_ strretention_ rule_ id - ID of the resource.
- cron
Setting String - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- namespace
Name String - The Name of the namespace.
- registry
Id String - The main instance ID.
- retention
Rule Property Map - Retention Policy.
- disabled Boolean
- Whether to disable the rule, with the default value of false.
- tcr
Tag StringRetention Rule Id - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the TcrTagRetentionRule resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Retention
Id double - The ID of the retention task.
- Id string
- The provider-assigned unique ID for this managed resource.
- Retention
Id float64 - The ID of the retention task.
- id String
- The provider-assigned unique ID for this managed resource.
- retention
Id Double - The ID of the retention task.
- id string
- The provider-assigned unique ID for this managed resource.
- retention
Id number - The ID of the retention task.
- id str
- The provider-assigned unique ID for this managed resource.
- retention_
id float - The ID of the retention task.
- id String
- The provider-assigned unique ID for this managed resource.
- retention
Id Number - The ID of the retention task.
Look up Existing TcrTagRetentionRule Resource
Get an existing TcrTagRetentionRule 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?: TcrTagRetentionRuleState, opts?: CustomResourceOptions): TcrTagRetentionRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cron_setting: Optional[str] = None,
disabled: Optional[bool] = None,
namespace_name: Optional[str] = None,
registry_id: Optional[str] = None,
retention_id: Optional[float] = None,
retention_rule: Optional[TcrTagRetentionRuleRetentionRuleArgs] = None,
tcr_tag_retention_rule_id: Optional[str] = None) -> TcrTagRetentionRule
func GetTcrTagRetentionRule(ctx *Context, name string, id IDInput, state *TcrTagRetentionRuleState, opts ...ResourceOption) (*TcrTagRetentionRule, error)
public static TcrTagRetentionRule Get(string name, Input<string> id, TcrTagRetentionRuleState? state, CustomResourceOptions? opts = null)
public static TcrTagRetentionRule get(String name, Output<String> id, TcrTagRetentionRuleState state, CustomResourceOptions options)
resources: _: type: tencentcloud:TcrTagRetentionRule 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.
- Cron
Setting string - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- Disabled bool
- Whether to disable the rule, with the default value of false.
- Namespace
Name string - The Name of the namespace.
- Registry
Id string - The main instance ID.
- Retention
Id double - The ID of the retention task.
- Retention
Rule TcrTag Retention Rule Retention Rule - Retention Policy.
- Tcr
Tag stringRetention Rule Id - ID of the resource.
- Cron
Setting string - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- Disabled bool
- Whether to disable the rule, with the default value of false.
- Namespace
Name string - The Name of the namespace.
- Registry
Id string - The main instance ID.
- Retention
Id float64 - The ID of the retention task.
- Retention
Rule TcrTag Retention Rule Retention Rule Args - Retention Policy.
- Tcr
Tag stringRetention Rule Id - ID of the resource.
- cron
Setting String - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- disabled Boolean
- Whether to disable the rule, with the default value of false.
- namespace
Name String - The Name of the namespace.
- registry
Id String - The main instance ID.
- retention
Id Double - The ID of the retention task.
- retention
Rule TcrTag Retention Rule Retention Rule - Retention Policy.
- tcr
Tag StringRetention Rule Id - ID of the resource.
- cron
Setting string - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- disabled boolean
- Whether to disable the rule, with the default value of false.
- namespace
Name string - The Name of the namespace.
- registry
Id string - The main instance ID.
- retention
Id number - The ID of the retention task.
- retention
Rule TcrTag Retention Rule Retention Rule - Retention Policy.
- tcr
Tag stringRetention Rule Id - ID of the resource.
- cron_
setting str - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- disabled bool
- Whether to disable the rule, with the default value of false.
- namespace_
name str - The Name of the namespace.
- registry_
id str - The main instance ID.
- retention_
id float - The ID of the retention task.
- retention_
rule TcrTag Retention Rule Retention Rule Args - Retention Policy.
- tcr_
tag_ strretention_ rule_ id - ID of the resource.
- cron
Setting String - Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
- disabled Boolean
- Whether to disable the rule, with the default value of false.
- namespace
Name String - The Name of the namespace.
- registry
Id String - The main instance ID.
- retention
Id Number - The ID of the retention task.
- retention
Rule Property Map - Retention Policy.
- tcr
Tag StringRetention Rule Id - ID of the resource.
Supporting Types
TcrTagRetentionRuleRetentionRule, TcrTagRetentionRuleRetentionRuleArgs
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloud
Terraform Provider.