Skip to content

Commit

Permalink
Merge pull request #163 from volcengine/Feat/cdn
Browse files Browse the repository at this point in the history
Feat/cdn
  • Loading branch information
msq177 committed Apr 29, 2024
2 parents 21b62fc + 7dd142c commit 0670150
Show file tree
Hide file tree
Showing 43 changed files with 4,374 additions and 16 deletions.
2 changes: 1 addition & 1 deletion common/common_volcengine_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package common

const (
TerraformProviderName = "terraform-provider-volcengine"
TerraformProviderVersion = "0.0.142"
TerraformProviderVersion = "0.0.143"
)
1 change: 1 addition & 0 deletions docgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ var resourceKeys = map[string]string{
"rds_mssql": "RDS_MSSQL",
"rds_postgresql": "RDS_POSTGRESQL",
"organization": "ORGANIZATION",
"cdn": "CDN",
}

type Products struct {
Expand Down
6 changes: 6 additions & 0 deletions example/cdnCertificate/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "volcengine_cdn_certificate" "foo" {
certificate = ""
private_key = ""
desc = "tftest"
source = "cdn_cert_hosting"
}
54 changes: 54 additions & 0 deletions example/cdnDomain/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
resource "volcengine_cdn_certificate" "foo" {
certificate = ""
private_key = ""
desc = "tftest"
source = "cdn_cert_hosting"
}

resource "volcengine_cdn_domain" "foo" {
domain = "tftest.byte-test.com"
service_type = "web"
tags {
key = "tfkey1"
value = "tfvalue1"
}
tags {
key = "tfkey2"
value = "tfvalue2"
}
domain_config = jsonencode(
{
OriginProtocol = "https"
Origin = [
{
OriginAction = {
OriginLines = [
{
Address = "1.1.1.1",
HttpPort = "80",
HttpsPort = "443",
InstanceType = "ip",
OriginType = "primary",
PrivateBucketAccess = false,
Weight = "2"
}
]
}
}
]
HTTPS = {
CertInfo = {
CertId = volcengine_cdn_certificate.foo.id
}
DisableHttp = false,
HTTP2 = true,
Switch = true,
Ocsp = false,
TlsVersion = [
"tlsv1.1",
"tlsv1.2"
],
}
}
)
}
25 changes: 25 additions & 0 deletions example/cdnSharedConfig/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
resource "volcengine_cdn_shared_config" "foo" {
config_name = "tftest"
config_type = "allow_referer_access_rule"
allow_ip_access_rule {
rules = ["1.1.1.1", "2.2.2.0/24", "3.3.3.3"]
}
deny_ip_access_rule {
rules = ["1.1.1.1", "2.2.2.0/24"]
}
common_match_list {
common_type {
rules = ["1.1.1.1", "2.2.2.0/24"]
}
}
allow_referer_access_rule {
common_type {
rules = ["1.1.1.1", "2.2.2.0/24", "3.3.4.4"]
}
}
deny_referer_access_rule {
common_type {
rules = ["1.1.1.1", "2.2.2.0/24"]
}
}
}
10 changes: 10 additions & 0 deletions example/dataCdnCertificates/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "volcengine_cdn_certificate" "foo" {
certificate = ""
private_key = ""
desc = "tftest"
source = "cdn_cert_hosting"
}

data "volcengine_cdn_certificates" "foo"{
source = volcengine_cdn_certificate.foo.source
}
58 changes: 58 additions & 0 deletions example/dataCdnConfigs/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
resource "volcengine_cdn_certificate" "foo" {
certificate = ""
private_key = ""
desc = "tftest"
source = "cdn_cert_hosting"
}

resource "volcengine_cdn_domain" "foo" {
domain = "tftest.byte-test.com"
service_type = "web"
tags {
key = "tfkey1"
value = "tfvalue1"
}
tags {
key = "tfkey2"
value = "tfvalue2"
}
domain_config = jsonencode(
{
OriginProtocol = "https"
Origin = [
{
OriginAction = {
OriginLines = [
{
Address = "1.1.1.1",
HttpPort = "80",
HttpsPort = "443",
InstanceType = "ip",
OriginType = "primary",
PrivateBucketAccess = false,
Weight = "2"
}
]
}
}
]
HTTPS = {
CertInfo = {
CertId = volcengine_cdn_certificate.foo.id
}
DisableHttp = false,
HTTP2 = true,
Switch = true,
Ocsp = false,
TlsVersion = [
"tlsv1.1",
"tlsv1.2"
],
}
}
)
}

data "volcengine_cdn_configs" "foo"{
domain = volcengine_cdn_domain.foo.id
}
58 changes: 58 additions & 0 deletions example/dataCdnDomains/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
resource "volcengine_cdn_certificate" "foo" {
certificate = ""
private_key = ""
desc = "tftest"
source = "cdn_cert_hosting"
}

resource "volcengine_cdn_domain" "foo" {
domain = "tftest.byte-test.com"
service_type = "web"
tags {
key = "tfkey1"
value = "tfvalue1"
}
tags {
key = "tfkey2"
value = "tfvalue2"
}
domain_config = jsonencode(
{
OriginProtocol = "https"
Origin = [
{
OriginAction = {
OriginLines = [
{
Address = "1.1.1.1",
HttpPort = "80",
HttpsPort = "443",
InstanceType = "ip",
OriginType = "primary",
PrivateBucketAccess = false,
Weight = "2"
}
]
}
}
]
HTTPS = {
CertInfo = {
CertId = volcengine_cdn_certificate.foo.id
}
DisableHttp = false,
HTTP2 = true,
Switch = true,
Ocsp = false,
TlsVersion = [
"tlsv1.1",
"tlsv1.2"
],
}
}
)
}

data "volcengine_cdn_domains" "foo"{
domain = volcengine_cdn_domain.foo.id
}
5 changes: 5 additions & 0 deletions example/dataCdnSharedConfigs/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data "volcengine_cdn_shared_configs" "foo"{
config_name = "tf-test"
config_type = "allow_ip_access_rule"
project_name = "default"
}
2 changes: 2 additions & 0 deletions example/dataIamAccessKeys/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data "volcengine_iam_access_keys" "foo"{
}
76 changes: 76 additions & 0 deletions example/dataRdsPostgresqlSchemas/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
data "volcengine_zones" "foo" {
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-project1"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-subnet-test-2"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}


resource "volcengine_rds_postgresql_instance" "foo" {
db_engine_version = "PostgreSQL_12"
node_spec = "rds.postgres.1c2g"
primary_zone_id = data.volcengine_zones.foo.zones[0].id
secondary_zone_id = data.volcengine_zones.foo.zones[0].id
storage_space = 40
subnet_id = volcengine_subnet.foo.id
instance_name = "acc-test-1"
charge_info {
charge_type = "PostPaid"
}
project_name = "default"
tags {
key = "tfk1"
value = "tfv1"
}
parameters {
name = "auto_explain.log_analyze"
value = "off"
}
parameters {
name = "auto_explain.log_format"
value = "text"
}
}

resource "volcengine_rds_postgresql_database" "foo" {
db_name = "acc-test"
instance_id = volcengine_rds_postgresql_instance.foo.id
c_type = "C"
collate = "zh_CN.utf8"
}

resource "volcengine_rds_postgresql_account" "foo" {
account_name = "acc-test-account"
account_password = "9wc@********12"
account_type = "Normal"
instance_id = volcengine_rds_postgresql_instance.foo.id
account_privileges = "Inherit,Login,CreateRole,CreateDB"
}

resource "volcengine_rds_postgresql_account" "foo1" {
account_name = "acc-test-account1"
account_password = "9wc@*******12"
account_type = "Normal"
instance_id = volcengine_rds_postgresql_instance.foo.id
account_privileges = "Inherit,Login,CreateRole,CreateDB"
}

resource "volcengine_rds_postgresql_schema" "foo" {
db_name = volcengine_rds_postgresql_database.foo.db_name
instance_id = volcengine_rds_postgresql_instance.foo.id
owner = volcengine_rds_postgresql_account.foo.account_name
schema_name = "acc-test-schema"
}

data "volcengine_rds_postgresql_schemas" "foo"{
db_name = volcengine_rds_postgresql_schema.foo.db_name
instance_id = volcengine_rds_postgresql_instance.foo.id
}
71 changes: 71 additions & 0 deletions example/rdsPostgresqlSchema/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
data "volcengine_zones" "foo" {
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-project1"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-subnet-test-2"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}


resource "volcengine_rds_postgresql_instance" "foo" {
db_engine_version = "PostgreSQL_12"
node_spec = "rds.postgres.1c2g"
primary_zone_id = data.volcengine_zones.foo.zones[0].id
secondary_zone_id = data.volcengine_zones.foo.zones[0].id
storage_space = 40
subnet_id = volcengine_subnet.foo.id
instance_name = "acc-test-1"
charge_info {
charge_type = "PostPaid"
}
project_name = "default"
tags {
key = "tfk1"
value = "tfv1"
}
parameters {
name = "auto_explain.log_analyze"
value = "off"
}
parameters {
name = "auto_explain.log_format"
value = "text"
}
}

resource "volcengine_rds_postgresql_database" "foo" {
db_name = "acc-test"
instance_id = volcengine_rds_postgresql_instance.foo.id
c_type = "C"
collate = "zh_CN.utf8"
}

resource "volcengine_rds_postgresql_account" "foo" {
account_name = "acc-test-account"
account_password = "9wc@********12"
account_type = "Normal"
instance_id = volcengine_rds_postgresql_instance.foo.id
account_privileges = "Inherit,Login,CreateRole,CreateDB"
}

resource "volcengine_rds_postgresql_account" "foo1" {
account_name = "acc-test-account1"
account_password = "9wc@*******12"
account_type = "Normal"
instance_id = volcengine_rds_postgresql_instance.foo.id
account_privileges = "Inherit,Login,CreateRole,CreateDB"
}

resource "volcengine_rds_postgresql_schema" "foo" {
db_name = volcengine_rds_postgresql_database.foo.db_name
instance_id = volcengine_rds_postgresql_instance.foo.id
owner = volcengine_rds_postgresql_account.foo.account_name
schema_name = "acc-test-schema"
}
Loading

0 comments on commit 0670150

Please sign in to comment.