Skip to content

Commit e571825

Browse files
committed
add doc examples for config
1 parent 6142261 commit e571825

File tree

27 files changed

+555
-0
lines changed

27 files changed

+555
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
## Introduction
3+
4+
This example is used to create a `alicloud_config_aggregate_compliance_pack` resource.
5+
6+
## Providers
7+
8+
| Name | Version |
9+
|------|---------|
10+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | n/a |
11+
12+
## Resources
13+
14+
| Name | Type |
15+
|------|------|
16+
| [alicloud_config_aggregate_compliance_pack.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/config_aggregate_compliance_pack) | resource |
17+
| [alicloud_config_aggregate_config_rule.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/config_aggregate_config_rule) | resource |
18+
| [alicloud_config_aggregator.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/config_aggregator) | resource |
19+
| [alicloud_resource_manager_accounts.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/data-sources/resource_manager_accounts) | data source |
20+
21+
## Inputs
22+
23+
| Name | Description | Type | Default | Required |
24+
|------|-------------|------|---------|:--------:|
25+
| <a name="input_name"></a> [name](#input\_name) | n/a | `string` | `"terraform_example"` | no |
26+
<!-- END_TF_DOCS -->
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
variable "name" {
2+
default = "terraform_example"
3+
}
4+
5+
data "alicloud_resource_manager_accounts" "default" {
6+
status = "CreateSuccess"
7+
}
8+
9+
resource "alicloud_config_aggregator" "default" {
10+
aggregator_accounts {
11+
account_id = data.alicloud_resource_manager_accounts.default.accounts.0.account_id
12+
account_name = data.alicloud_resource_manager_accounts.default.accounts.0.display_name
13+
account_type = "ResourceDirectory"
14+
}
15+
aggregator_name = var.name
16+
description = var.name
17+
aggregator_type = "CUSTOM"
18+
}
19+
20+
resource "alicloud_config_aggregate_config_rule" "default" {
21+
aggregate_config_rule_name = "contains-tag"
22+
aggregator_id = alicloud_config_aggregator.default.id
23+
config_rule_trigger_types = "ConfigurationItemChangeNotification"
24+
source_owner = "ALIYUN"
25+
source_identifier = "contains-tag"
26+
description = var.name
27+
risk_level = 1
28+
resource_types_scope = ["ACS::ECS::Instance"]
29+
input_parameters = {
30+
key = "example"
31+
value = "example"
32+
}
33+
}
34+
35+
resource "alicloud_config_aggregate_compliance_pack" "default" {
36+
aggregate_compliance_pack_name = var.name
37+
aggregator_id = alicloud_config_aggregator.default.id
38+
description = var.name
39+
risk_level = 1
40+
config_rule_ids {
41+
config_rule_id = alicloud_config_aggregate_config_rule.default.config_rule_id
42+
}
43+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_providers {
3+
alicloud = {
4+
source = "aliyun/alicloud"
5+
}
6+
}
7+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
## Introduction
3+
4+
This example is used to create a `alicloud_config_aggregate_config_rule` resource.
5+
6+
## Providers
7+
8+
| Name | Version |
9+
|------|---------|
10+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | n/a |
11+
12+
## Resources
13+
14+
| Name | Type |
15+
|------|------|
16+
| [alicloud_config_aggregate_config_rule.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/config_aggregate_config_rule) | resource |
17+
| [alicloud_config_aggregator.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/config_aggregator) | resource |
18+
| [alicloud_resource_manager_accounts.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/data-sources/resource_manager_accounts) | data source |
19+
20+
## Inputs
21+
22+
| Name | Description | Type | Default | Required |
23+
|------|-------------|------|---------|:--------:|
24+
| <a name="input_name"></a> [name](#input\_name) | n/a | `string` | `"tf-example"` | no |
25+
<!-- END_TF_DOCS -->
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
variable "name" {
2+
default = "tf-example"
3+
}
4+
data "alicloud_resource_manager_accounts" "default" {
5+
status = "CreateSuccess"
6+
}
7+
8+
resource "alicloud_config_aggregator" "default" {
9+
aggregator_accounts {
10+
account_id = data.alicloud_resource_manager_accounts.default.accounts.0.account_id
11+
account_name = data.alicloud_resource_manager_accounts.default.accounts.0.display_name
12+
account_type = "ResourceDirectory"
13+
}
14+
aggregator_name = var.name
15+
description = var.name
16+
aggregator_type = "CUSTOM"
17+
}
18+
resource "alicloud_config_aggregate_config_rule" "default" {
19+
aggregate_config_rule_name = "contains-tag"
20+
aggregator_id = alicloud_config_aggregator.default.id
21+
config_rule_trigger_types = "ConfigurationItemChangeNotification"
22+
source_owner = "ALIYUN"
23+
source_identifier = "contains-tag"
24+
risk_level = 1
25+
resource_types_scope = ["ACS::ECS::Instance"]
26+
input_parameters = {
27+
key = "example"
28+
value = "example"
29+
}
30+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_providers {
3+
alicloud = {
4+
source = "aliyun/alicloud"
5+
}
6+
}
7+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
## Introduction
3+
4+
This example is used to create a `alicloud_config_aggregate_delivery` resource.
5+
6+
## Providers
7+
8+
| Name | Version |
9+
|------|---------|
10+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | n/a |
11+
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
12+
13+
## Resources
14+
15+
| Name | Type |
16+
|------|------|
17+
| [alicloud_config_aggregate_delivery.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/config_aggregate_delivery) | resource |
18+
| [alicloud_config_aggregator.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/config_aggregator) | resource |
19+
| [alicloud_log_project.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/log_project) | resource |
20+
| [alicloud_log_store.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/log_store) | resource |
21+
| [random_uuid.default](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid) | resource |
22+
| [alicloud_account.this](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/data-sources/account) | data source |
23+
| [alicloud_regions.this](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/data-sources/regions) | data source |
24+
| [alicloud_resource_manager_accounts.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/data-sources/resource_manager_accounts) | data source |
25+
26+
## Inputs
27+
28+
| Name | Description | Type | Default | Required |
29+
|------|-------------|------|---------|:--------:|
30+
| <a name="input_name"></a> [name](#input\_name) | n/a | `string` | `"tf_example"` | no |
31+
<!-- END_TF_DOCS -->
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
variable "name" {
2+
default = "tf_example"
3+
}
4+
data "alicloud_regions" "this" {
5+
current = true
6+
}
7+
data "alicloud_account" "this" {}
8+
data "alicloud_resource_manager_accounts" "default" {
9+
status = "CreateSuccess"
10+
}
11+
resource "alicloud_config_aggregator" "default" {
12+
aggregator_accounts {
13+
account_id = data.alicloud_resource_manager_accounts.default.accounts.0.account_id
14+
account_name = data.alicloud_resource_manager_accounts.default.accounts.0.display_name
15+
account_type = "ResourceDirectory"
16+
}
17+
aggregator_name = var.name
18+
description = var.name
19+
aggregator_type = "CUSTOM"
20+
}
21+
22+
resource "random_uuid" "default" {}
23+
resource "alicloud_log_project" "default" {
24+
name = substr("tf-example-${replace(random_uuid.default.result, "-", "")}", 0, 16)
25+
}
26+
resource "alicloud_log_store" "default" {
27+
name = var.name
28+
project = alicloud_log_project.default.name
29+
}
30+
resource "alicloud_config_aggregate_delivery" "default" {
31+
aggregator_id = alicloud_config_aggregator.default.id
32+
configuration_item_change_notification = true
33+
non_compliant_notification = true
34+
delivery_channel_name = var.name
35+
delivery_channel_target_arn = "acs:log:${data.alicloud_regions.this.ids.0}:${data.alicloud_account.this.id}:project/${alicloud_log_project.default.name}/logstore/${alicloud_log_store.default.name}"
36+
delivery_channel_type = "SLS"
37+
description = var.name
38+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_providers {
3+
alicloud = {
4+
source = "aliyun/alicloud"
5+
}
6+
}
7+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
## Introduction
3+
4+
This example is used to create a `alicloud_config_aggregator` resource.
5+
6+
## Providers
7+
8+
| Name | Version |
9+
|------|---------|
10+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | n/a |
11+
12+
## Resources
13+
14+
| Name | Type |
15+
|------|------|
16+
| [alicloud_config_aggregator.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/config_aggregator) | resource |
17+
| [alicloud_resource_manager_accounts.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/data-sources/resource_manager_accounts) | data source |
18+
19+
## Inputs
20+
21+
| Name | Description | Type | Default | Required |
22+
|------|-------------|------|---------|:--------:|
23+
| <a name="input_name"></a> [name](#input\_name) | n/a | `string` | `"tf_example"` | no |
24+
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)