Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .githooks/pre-commit-local
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
REQUIRED_GO_VERSION="1.18" # use the .go-version later

printf "==> Step 1: Gofmt Check...\n"
make fmt-faster
if [ $? -ne 0 ]; then
printf "COMMIT FAILED\n"
exit 1
fi

printf "==> Step 2: Generating docs...\n"
doc=$(make doc 2>&1)
if [ $? -ne 0 ]; then
echo "$doc" | tail -n 4 | head -n 2
printf "COMMIT FAILED\n"
exit 1
fi

printf "==> Step 2: Generating docs...\n"
go_version=$(go version | awk '{print $3}')
if [ $go_version -ne $REQUIRED_GO_VERSION* ]; then
echo "Go version is not compatible. Expected $REQUIRED_GO_VERSION.x"
printf "COMMIT FAILED\n"
exit 1
fi

printf "COMMIT READY\n"
exit 0
2 changes: 1 addition & 1 deletion tencentcloud/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ variable "cam_user_basic" {

// TCR Service
const defaultTCRInstanceName = "keep-tcr-instance-sh"
const defaultTCRInstanceId = "tcr-800uf6j9"
const defaultTCRInstanceId = "tcr-aoz8mxoz"
const defaultTCRNamespace = "keep-tcr-namespace-sh"
const defaultTCRRepoName = "keep-tcr-repo-sh"
const defaultTCRSSL = "zjUMifFK"
Expand Down
39 changes: 33 additions & 6 deletions tencentcloud/resource_tc_tcr_create_image_signature_operation.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
/*
Provides a resource to create a tcr image_signature_operation
Provides a resource to operate a tcr image signature.

Example Usage

```hcl
resource "tencentcloud_tcr_create_image_signature_operation" "image_signature_operation" {
registry_id = "tcr-xxx"
namespace_name = "ns"
repository_name = "repo"
image_version = "v1"
resource "tencentcloud_tcr_instance" "example" {
name = "tf-example-tcr"
instance_type = "premium"
tags = {
"createdBy" = "terraform"
}
}

resource "tencentcloud_tcr_namespace" "example" {
instance_id = tencentcloud_tcr_instance.example.id
name = "tf_example_ns"
is_public = true
is_auto_scan = true
is_prevent_vul = true
severity = "medium"
cve_whitelist_items {
cve_id = "cve-xxxxx"
}
}

resource "tencentcloud_tcr_repository" "example" {
instance_id = tencentcloud_tcr_instance.example.id
namespace_name = tencentcloud_tcr_namespace.example.name
name = "test"
brief_desc = "111"
description = "111111111111111111111111111111111111"
}

resource "tencentcloud_tcr_create_image_signature_operation" "example" {
registry_id = tencentcloud_tcr_instance.example.id
namespace_name = tencentcloud_tcr_namespace.example.name
repository_name = tencentcloud_tcr_repository.example.name
image_version = "v1"
}
```

Expand Down
20 changes: 15 additions & 5 deletions tencentcloud/resource_tc_tcr_customized_domain.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
/*
Provides a resource to create a tcr customized_domain
Provides a resource to create a tcr customized domain

Example Usage

Create a tcr customized domain

```hcl
resource "tencentcloud_tcr_customized_domain" "my_domain" {
registry_id = local.tcr_id
domain_name = "www.test.com"
certificate_id = "%s"
resource "tencentcloud_tcr_instance" "example" {
name = "tf-example-tcr"
instance_type = "premium"
tags = {
"createdBy" = "terraform"
}
}

resource "tencentcloud_tcr_customized_domain" "example" {
registry_id = tencentcloud_tcr_instance.example.id
domain_name = "www.test.com"
certificate_id = "your_cert_id"
tags = {
"createdBy" = "terraform"
}
Expand Down
33 changes: 27 additions & 6 deletions tencentcloud/resource_tc_tcr_delete_image_operation.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
/*
Provides a resource to create a tcr delete_image_operation
Provides a resource to delete the specified tcr image.

Example Usage

To delete the specified image

```hcl
resource "tencentcloud_tcr_delete_image_operation" "delete_image_operation" {
registry_id = "tcr-xxx"
resource "tencentcloud_tcr_instance" "example" {
name = "tf-example-tcr"
instance_type = "premium"
tags = {
"createdBy" = "terraform"
}
}

resource "tencentcloud_tcr_namespace" "example" {
instance_id = tencentcloud_tcr_instance.example.id
name = "tf_example_ns"
is_public = true
is_auto_scan = true
is_prevent_vul = true
severity = "medium"
cve_whitelist_items {
cve_id = "cve-xxxxx"
}
}

resource "tencentcloud_tcr_delete_image_operation" "example" {
registry_id = tencentcloud_tcr_instance.example.id
repository_name = "repo"
image_version = "v1"
namespace_name = "ns"
image_version = "v1" # the image want to delete
namespace_name = tencentcloud_tcr_namespace.example.name
}
```

*/
package tencentcloud

Expand Down
91 changes: 82 additions & 9 deletions tencentcloud/resource_tc_tcr_immutable_tag_rule.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,91 @@
/*
Provides a resource to create a tcr immutable_tag_rule
Provides a resource to create a tcr immutable tag rule.

Example Usage

Create a immutable tag rule with specified tags and exclude specified repositories

```hcl
resource "tencentcloud_tcr_immutable_tag_rule" "my_rule" {
registry_id = "%s"
namespace_name = "%s"
resource "tencentcloud_tcr_instance" "example" {
name = "tf-example-tcr"
instance_type = "premium"
delete_bucket = true
}

resource "tencentcloud_tcr_namespace" "example" {
instance_id = tencentcloud_tcr_instance.example.id
name = "tf_example_ns"
is_public = true
is_auto_scan = true
is_prevent_vul = true
severity = "medium"
cve_whitelist_items {
cve_id = "cve-xxxxx"
}
}

resource "tencentcloud_tcr_immutable_tag_rule" "example" {
registry_id = tencentcloud_tcr_instance.example.id
namespace_name = tencentcloud_tcr_namespace.example.name
rule {
repository_pattern = "deprecated_repo" # specify exclude repo
tag_pattern = "**" # all tags
repository_decoration = "repoExcludes"
tag_decoration = "matches"
disabled = false
}
tags = {
"createdBy" = "terraform"
}
}
```

With specified repositories and exclude specified version tag

```hcl
resource "tencentcloud_tcr_immutable_tag_rule" "example" {
registry_id = tencentcloud_tcr_instance.example.id
namespace_name = tencentcloud_tcr_namespace.example.name
rule {
repository_pattern = "**" # all repo
tag_pattern = "v1" # exlude v1 tags
repository_decoration = "repoMatches"
tag_decoration = "excludes"
disabled = false
}
tags = {
"createdBy" = "terraform"
}
}
```

Disabled the specified rule

```hcl
resource "tencentcloud_tcr_immutable_tag_rule" "example_rule_A" {
registry_id = tencentcloud_tcr_instance.example.id
namespace_name = tencentcloud_tcr_namespace.example.name
rule {
repository_pattern = "deprecated_repo" # specify exclude repo
tag_pattern = "**" # all tags
repository_decoration = "repoExcludes"
tag_decoration = "matches"
disabled = false
}
tags = {
"createdBy" = "terraform"
}
}

resource "tencentcloud_tcr_immutable_tag_rule" "example_rule_B" {
registry_id = tencentcloud_tcr_instance.example.id
namespace_name = tencentcloud_tcr_namespace.example.name
rule {
repository_pattern = "**"
tag_pattern = "**"
repository_decoration = "repoMatches"
tag_decoration = "matches"
disabled = false
repository_pattern = "**" # all repo
tag_pattern = "v1" # exlude v1 tags
repository_decoration = "repoMatches"
tag_decoration = "excludes"
disabled = true # disable it
}
tags = {
"createdBy" = "terraform"
Expand Down
24 changes: 13 additions & 11 deletions tencentcloud/resource_tc_tcr_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@ Use this resource to create tcr instance.

Example Usage

Create a basic tcr instance.

```hcl
resource "tencentcloud_tcr_instance" "foo" {
name = "example"
resource "tencentcloud_tcr_instance" "example" {
name = "tf-example-tcr"
instance_type = "basic"

tags = {
test = "tf"
"createdBy" = "terraform"
}
}
```

Using public network access whitelist
Create instance with the public network access whitelist.

```hcl
resource "tencentcloud_tcr_instance" "foo" {
name = "example"
resource "tencentcloud_tcr_instance" "example" {
name = "tf-example-tcr"
instance_type = "basic"
open_public_operation = true
security_policy {
Expand All @@ -29,12 +32,11 @@ resource "tencentcloud_tcr_instance" "foo" {
}
```

Create with Replications
Create instance with Replications.

```hcl

resource "tencentcloud_tcr_instance" "foo" {
name = "example"
resource "tencentcloud_tcr_instance" "example" {
name = "tf-example-tcr"
instance_type = "premium"
replications {
region_id = var.tcr_region_map["ap-guangzhou"] # 1
Expand Down Expand Up @@ -73,7 +75,7 @@ Import
tcr instance can be imported using the id, e.g.

```
$ terraform import tencentcloud_tcr_instance.foo cls-cda1iex1
$ terraform import tencentcloud_tcr_instance.foo instance_id
```
*/
package tencentcloud
Expand Down
Loading