tencentcloud.TcrWebhookTrigger
Explore with Pulumi AI
Provides a resource to create a tcr webhook trigger
Example Usage
Create a tcr webhook trigger instance
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const exampleTcrInstance = new tencentcloud.TcrInstance("exampleTcrInstance", {
instanceType: "basic",
deleteBucket: true,
tags: {
test: "test",
},
});
const exampleTcrNamespace = new tencentcloud.TcrNamespace("exampleTcrNamespace", {
instanceId: exampleTcrInstance.tcrInstanceId,
isPublic: true,
isAutoScan: true,
isPreventVul: true,
severity: "medium",
cveWhitelistItems: [{
cveId: "cve-xxxxx",
}],
});
const exampleTcrNamespaces = tencentcloud.getTcrNamespacesOutput({
instanceId: exampleTcrNamespace.instanceId,
});
const nsId = exampleTcrNamespaces.apply(exampleTcrNamespaces => exampleTcrNamespaces.namespaceLists?.[0]?.id);
const exampleTcrWebhookTrigger = new tencentcloud.TcrWebhookTrigger("exampleTcrWebhookTrigger", {
registryId: exampleTcrInstance.tcrInstanceId,
namespace: exampleTcrNamespace.name,
trigger: {
name: "trigger-example",
targets: [{
address: "http://example.org/post",
headers: [{
key: "X-Custom-Header",
values: ["a"],
}],
}],
eventTypes: ["pushImage"],
condition: ".*",
enabled: true,
description: "example for trigger description",
namespaceId: nsId,
},
tags: {
createdBy: "terraform",
},
});
import pulumi
import pulumi_tencentcloud as tencentcloud
example_tcr_instance = tencentcloud.TcrInstance("exampleTcrInstance",
instance_type="basic",
delete_bucket=True,
tags={
"test": "test",
})
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",
}])
example_tcr_namespaces = tencentcloud.get_tcr_namespaces_output(instance_id=example_tcr_namespace.instance_id)
ns_id = example_tcr_namespaces.namespace_lists[0].id
example_tcr_webhook_trigger = tencentcloud.TcrWebhookTrigger("exampleTcrWebhookTrigger",
registry_id=example_tcr_instance.tcr_instance_id,
namespace=example_tcr_namespace.name,
trigger={
"name": "trigger-example",
"targets": [{
"address": "http://example.org/post",
"headers": [{
"key": "X-Custom-Header",
"values": ["a"],
}],
}],
"event_types": ["pushImage"],
"condition": ".*",
"enabled": True,
"description": "example for trigger description",
"namespace_id": ns_id,
},
tags={
"createdBy": "terraform",
})
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{
"test": pulumi.String("test"),
},
})
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
}
exampleTcrNamespaces := tencentcloud.GetTcrNamespacesOutput(ctx, tencentcloud.GetTcrNamespacesOutputArgs{
InstanceId: exampleTcrNamespace.InstanceId,
}, nil)
nsId := exampleTcrNamespaces.ApplyT(func(exampleTcrNamespaces tencentcloud.GetTcrNamespacesResult) (*float64, error) {
return &exampleTcrNamespaces.NamespaceLists[0].Id, nil
}).(pulumi.Float64PtrOutput)
_, err = tencentcloud.NewTcrWebhookTrigger(ctx, "exampleTcrWebhookTrigger", &tencentcloud.TcrWebhookTriggerArgs{
RegistryId: exampleTcrInstance.TcrInstanceId,
Namespace: exampleTcrNamespace.Name,
Trigger: &tencentcloud.TcrWebhookTriggerTriggerArgs{
Name: pulumi.String("trigger-example"),
Targets: tencentcloud.TcrWebhookTriggerTriggerTargetArray{
&tencentcloud.TcrWebhookTriggerTriggerTargetArgs{
Address: pulumi.String("http://example.org/post"),
Headers: tencentcloud.TcrWebhookTriggerTriggerTargetHeaderArray{
&tencentcloud.TcrWebhookTriggerTriggerTargetHeaderArgs{
Key: pulumi.String("X-Custom-Header"),
Values: pulumi.StringArray{
pulumi.String("a"),
},
},
},
},
},
EventTypes: pulumi.StringArray{
pulumi.String("pushImage"),
},
Condition: pulumi.String(".*"),
Enabled: pulumi.Bool(true),
Description: pulumi.String("example for trigger description"),
NamespaceId: pulumi.Float64(nsId),
},
Tags: pulumi.StringMap{
"createdBy": pulumi.String("terraform"),
},
})
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 =
{
{ "test", "test" },
},
});
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 exampleTcrNamespaces = Tencentcloud.GetTcrNamespaces.Invoke(new()
{
InstanceId = exampleTcrNamespace.InstanceId,
});
var nsId = exampleTcrNamespaces.Apply(getTcrNamespacesResult => getTcrNamespacesResult.NamespaceLists[0]?.Id);
var exampleTcrWebhookTrigger = new Tencentcloud.TcrWebhookTrigger("exampleTcrWebhookTrigger", new()
{
RegistryId = exampleTcrInstance.TcrInstanceId,
Namespace = exampleTcrNamespace.Name,
Trigger = new Tencentcloud.Inputs.TcrWebhookTriggerTriggerArgs
{
Name = "trigger-example",
Targets = new[]
{
new Tencentcloud.Inputs.TcrWebhookTriggerTriggerTargetArgs
{
Address = "http://example.org/post",
Headers = new[]
{
new Tencentcloud.Inputs.TcrWebhookTriggerTriggerTargetHeaderArgs
{
Key = "X-Custom-Header",
Values = new[]
{
"a",
},
},
},
},
},
EventTypes = new[]
{
"pushImage",
},
Condition = ".*",
Enabled = true,
Description = "example for trigger description",
NamespaceId = nsId,
},
Tags =
{
{ "createdBy", "terraform" },
},
});
});
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.TencentcloudFunctions;
import com.pulumi.tencentcloud.inputs.GetTcrNamespacesArgs;
import com.pulumi.tencentcloud.TcrWebhookTrigger;
import com.pulumi.tencentcloud.TcrWebhookTriggerArgs;
import com.pulumi.tencentcloud.inputs.TcrWebhookTriggerTriggerArgs;
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("test", "test"))
.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());
final var exampleTcrNamespaces = TencentcloudFunctions.getTcrNamespaces(GetTcrNamespacesArgs.builder()
.instanceId(exampleTcrNamespace.instanceId())
.build());
final var nsId = exampleTcrNamespaces.applyValue(getTcrNamespacesResult -> getTcrNamespacesResult).applyValue(exampleTcrNamespaces -> exampleTcrNamespaces.applyValue(getTcrNamespacesResult -> getTcrNamespacesResult.namespaceLists()[0].id()));
var exampleTcrWebhookTrigger = new TcrWebhookTrigger("exampleTcrWebhookTrigger", TcrWebhookTriggerArgs.builder()
.registryId(exampleTcrInstance.tcrInstanceId())
.namespace(exampleTcrNamespace.name())
.trigger(TcrWebhookTriggerTriggerArgs.builder()
.name("trigger-example")
.targets(TcrWebhookTriggerTriggerTargetArgs.builder()
.address("http://example.org/post")
.headers(TcrWebhookTriggerTriggerTargetHeaderArgs.builder()
.key("X-Custom-Header")
.values("a")
.build())
.build())
.eventTypes("pushImage")
.condition(".*")
.enabled(true)
.description("example for trigger description")
.namespaceId(nsId)
.build())
.tags(Map.of("createdBy", "terraform"))
.build());
}
}
resources:
exampleTcrInstance:
type: tencentcloud:TcrInstance
properties:
instanceType: basic
deleteBucket: true
tags:
test: test
exampleTcrNamespace:
type: tencentcloud:TcrNamespace
properties:
instanceId: ${exampleTcrInstance.tcrInstanceId}
isPublic: true
isAutoScan: true
isPreventVul: true
severity: medium
cveWhitelistItems:
- cveId: cve-xxxxx
exampleTcrWebhookTrigger:
type: tencentcloud:TcrWebhookTrigger
properties:
registryId: ${exampleTcrInstance.tcrInstanceId}
namespace: ${exampleTcrNamespace.name}
trigger:
name: trigger-example
targets:
- address: http://example.org/post
headers:
- key: X-Custom-Header
values:
- a
eventTypes:
- pushImage
condition: .*
enabled: true
description: example for trigger description
namespaceId: ${nsId}
tags:
createdBy: terraform
variables:
exampleTcrNamespaces:
fn::invoke:
function: tencentcloud:getTcrNamespaces
arguments:
instanceId: ${exampleTcrNamespace.instanceId}
nsId: ${exampleTcrNamespaces.namespaceLists[0].id}
Create TcrWebhookTrigger Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new TcrWebhookTrigger(name: string, args: TcrWebhookTriggerArgs, opts?: CustomResourceOptions);
@overload
def TcrWebhookTrigger(resource_name: str,
args: TcrWebhookTriggerArgs,
opts: Optional[ResourceOptions] = None)
@overload
def TcrWebhookTrigger(resource_name: str,
opts: Optional[ResourceOptions] = None,
namespace: Optional[str] = None,
registry_id: Optional[str] = None,
trigger: Optional[TcrWebhookTriggerTriggerArgs] = None,
tags: Optional[Mapping[str, str]] = None,
tcr_webhook_trigger_id: Optional[str] = None)
func NewTcrWebhookTrigger(ctx *Context, name string, args TcrWebhookTriggerArgs, opts ...ResourceOption) (*TcrWebhookTrigger, error)
public TcrWebhookTrigger(string name, TcrWebhookTriggerArgs args, CustomResourceOptions? opts = null)
public TcrWebhookTrigger(String name, TcrWebhookTriggerArgs args)
public TcrWebhookTrigger(String name, TcrWebhookTriggerArgs args, CustomResourceOptions options)
type: tencentcloud:TcrWebhookTrigger
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 TcrWebhookTriggerArgs
- 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 TcrWebhookTriggerArgs
- 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 TcrWebhookTriggerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TcrWebhookTriggerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TcrWebhookTriggerArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
TcrWebhookTrigger 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 TcrWebhookTrigger resource accepts the following input properties:
- Namespace string
- namespace name.
- Registry
Id string - instance Id.
- Trigger
Tcr
Webhook Trigger Trigger - trigger parameters.
- Dictionary<string, string>
- Tag description list.
- Tcr
Webhook stringTrigger Id - ID of the resource.
- Namespace string
- namespace name.
- Registry
Id string - instance Id.
- Trigger
Tcr
Webhook Trigger Trigger Args - trigger parameters.
- map[string]string
- Tag description list.
- Tcr
Webhook stringTrigger Id - ID of the resource.
- namespace String
- namespace name.
- registry
Id String - instance Id.
- trigger
Tcr
Webhook Trigger Trigger - trigger parameters.
- Map<String,String>
- Tag description list.
- tcr
Webhook StringTrigger Id - ID of the resource.
- namespace string
- namespace name.
- registry
Id string - instance Id.
- trigger
Tcr
Webhook Trigger Trigger - trigger parameters.
- {[key: string]: string}
- Tag description list.
- tcr
Webhook stringTrigger Id - ID of the resource.
- namespace str
- namespace name.
- registry_
id str - instance Id.
- trigger
Tcr
Webhook Trigger Trigger Args - trigger parameters.
- Mapping[str, str]
- Tag description list.
- tcr_
webhook_ strtrigger_ id - ID of the resource.
- namespace String
- namespace name.
- registry
Id String - instance Id.
- trigger Property Map
- trigger parameters.
- Map<String>
- Tag description list.
- tcr
Webhook StringTrigger Id - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the TcrWebhookTrigger 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 TcrWebhookTrigger Resource
Get an existing TcrWebhookTrigger 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?: TcrWebhookTriggerState, opts?: CustomResourceOptions): TcrWebhookTrigger
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
namespace: Optional[str] = None,
registry_id: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
tcr_webhook_trigger_id: Optional[str] = None,
trigger: Optional[TcrWebhookTriggerTriggerArgs] = None) -> TcrWebhookTrigger
func GetTcrWebhookTrigger(ctx *Context, name string, id IDInput, state *TcrWebhookTriggerState, opts ...ResourceOption) (*TcrWebhookTrigger, error)
public static TcrWebhookTrigger Get(string name, Input<string> id, TcrWebhookTriggerState? state, CustomResourceOptions? opts = null)
public static TcrWebhookTrigger get(String name, Output<String> id, TcrWebhookTriggerState state, CustomResourceOptions options)
resources: _: type: tencentcloud:TcrWebhookTrigger 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.
- Namespace string
- namespace name.
- Registry
Id string - instance Id.
- Dictionary<string, string>
- Tag description list.
- Tcr
Webhook stringTrigger Id - ID of the resource.
- Trigger
Tcr
Webhook Trigger Trigger - trigger parameters.
- Namespace string
- namespace name.
- Registry
Id string - instance Id.
- map[string]string
- Tag description list.
- Tcr
Webhook stringTrigger Id - ID of the resource.
- Trigger
Tcr
Webhook Trigger Trigger Args - trigger parameters.
- namespace String
- namespace name.
- registry
Id String - instance Id.
- Map<String,String>
- Tag description list.
- tcr
Webhook StringTrigger Id - ID of the resource.
- trigger
Tcr
Webhook Trigger Trigger - trigger parameters.
- namespace string
- namespace name.
- registry
Id string - instance Id.
- {[key: string]: string}
- Tag description list.
- tcr
Webhook stringTrigger Id - ID of the resource.
- trigger
Tcr
Webhook Trigger Trigger - trigger parameters.
- namespace str
- namespace name.
- registry_
id str - instance Id.
- Mapping[str, str]
- Tag description list.
- tcr_
webhook_ strtrigger_ id - ID of the resource.
- trigger
Tcr
Webhook Trigger Trigger Args - trigger parameters.
- namespace String
- namespace name.
- registry
Id String - instance Id.
- Map<String>
- Tag description list.
- tcr
Webhook StringTrigger Id - ID of the resource.
- trigger Property Map
- trigger parameters.
Supporting Types
TcrWebhookTriggerTrigger, TcrWebhookTriggerTriggerArgs
- Condition string
- trigger rule.
- Enabled bool
- enable trigger.
- Event
Types List<string> - trigger action.
- Name string
- trigger name.
- Targets
List<Tcr
Webhook Trigger Trigger Target> - trigger target.
- Description string
- trigger description.
- Id double
- ID of the resource.
- Namespace
Id double - the namespace Id to which the trigger belongs.
- Condition string
- trigger rule.
- Enabled bool
- enable trigger.
- Event
Types []string - trigger action.
- Name string
- trigger name.
- Targets
[]Tcr
Webhook Trigger Trigger Target - trigger target.
- Description string
- trigger description.
- Id float64
- ID of the resource.
- Namespace
Id float64 - the namespace Id to which the trigger belongs.
- condition String
- trigger rule.
- enabled Boolean
- enable trigger.
- event
Types List<String> - trigger action.
- name String
- trigger name.
- targets
List<Tcr
Webhook Trigger Trigger Target> - trigger target.
- description String
- trigger description.
- id Double
- ID of the resource.
- namespace
Id Double - the namespace Id to which the trigger belongs.
- condition string
- trigger rule.
- enabled boolean
- enable trigger.
- event
Types string[] - trigger action.
- name string
- trigger name.
- targets
Tcr
Webhook Trigger Trigger Target[] - trigger target.
- description string
- trigger description.
- id number
- ID of the resource.
- namespace
Id number - the namespace Id to which the trigger belongs.
- condition str
- trigger rule.
- enabled bool
- enable trigger.
- event_
types Sequence[str] - trigger action.
- name str
- trigger name.
- targets
Sequence[Tcr
Webhook Trigger Trigger Target] - trigger target.
- description str
- trigger description.
- id float
- ID of the resource.
- namespace_
id float - the namespace Id to which the trigger belongs.
- condition String
- trigger rule.
- enabled Boolean
- enable trigger.
- event
Types List<String> - trigger action.
- name String
- trigger name.
- targets List<Property Map>
- trigger target.
- description String
- trigger description.
- id Number
- ID of the resource.
- namespace
Id Number - the namespace Id to which the trigger belongs.
TcrWebhookTriggerTriggerTarget, TcrWebhookTriggerTriggerTargetArgs
- Address string
- target address.
- Headers
List<Tcr
Webhook Trigger Trigger Target Header> - custom Headers.
- Address string
- target address.
- Headers
[]Tcr
Webhook Trigger Trigger Target Header - custom Headers.
- address String
- target address.
- headers
List<Tcr
Webhook Trigger Trigger Target Header> - custom Headers.
- address string
- target address.
- headers
Tcr
Webhook Trigger Trigger Target Header[] - custom Headers.
- address str
- target address.
- headers
Sequence[Tcr
Webhook Trigger Trigger Target Header] - custom Headers.
- address String
- target address.
- headers List<Property Map>
- custom Headers.
TcrWebhookTriggerTriggerTargetHeader, TcrWebhookTriggerTriggerTargetHeaderArgs
Import
tcr webhook_trigger can be imported using the id, e.g.
$ pulumi import tencentcloud:index/tcrWebhookTrigger:TcrWebhookTrigger example webhook_trigger_id
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloud
Terraform Provider.