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
32 changes: 32 additions & 0 deletions tencentcloud/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,35 @@ resource "tencentcloud_mysql_instance" "default" {
force_delete = true
}
`
const defaultSCFCosBucket = `
data "tencentcloud_user_info" "info" {}

data "tencentcloud_cos_buckets" "buckets" {
bucket_prefix = "preset-scf-bucket-${data.tencentcloud_user_info.info.app_id}"
}

locals {
bucket_name = data.tencentcloud_cos_buckets.buckets.bucket_list.0.bucket
bucket_url = data.tencentcloud_cos_buckets.buckets.bucket_list.0.cos_bucket_url
}
`

const defaultScfNamespace = "preset-scf-namespace"

const defaultFileSystemName = "preset_cfs"

const defaultFileSystem = `
data "tencentcloud_cfs_file_systems" "fs" {
name = "` + defaultFileSystemName + `"
}

# doesn't support datasource for now
variable "mount_id" {
default = "cfs-iobiaxtj"
}

locals {
cfs = data.tencentcloud_cfs_file_systems.fs.file_system_list.0
cfs_id = local.cfs.file_system_id
access_group_id = local.cfs.access_group_id
}`
14 changes: 13 additions & 1 deletion tencentcloud/data_source_tc_scf_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ func dataSourceTencentCloudScfFunctions() *schema.Resource {
Computed: true,
Description: "Whether to enable L5.",
},
"enable_public_net": {
Type: schema.TypeBool,
Computed: true,
Description: "Whether the public net enabled.",
},
"enable_eip_config": {
Type: schema.TypeBool,
Computed: true,
Description: "Whether the EIP enabled.",
},
"tags": {
Type: schema.TypeMap,
Computed: true,
Expand Down Expand Up @@ -389,7 +399,9 @@ func dataSourceTencentCloudScfFunctionsRead(d *schema.ResourceData, m interface{
functions = append(functions, m)
}

_ = d.Set("functions", functions)
if err := d.Set("functions", functions); err != nil {
return err
}
d.SetId(helper.DataResourceIdsHash(ids))

if output, ok := d.GetOk("result_output_file"); ok && output.(string) != "" {
Expand Down
10 changes: 5 additions & 5 deletions tencentcloud/data_source_tc_scf_functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ resource "tencentcloud_scf_function" "foo" {
name = "%s"
handler = "first.do_it_first"
runtime = "Python3.6"
enable_public_net = true

zip_file = "%s"
}
Expand All @@ -156,15 +157,12 @@ data "tencentcloud_scf_functions" "foo" {
`

const TestAccDataSourceTencentCloudScfFunctionsNamespace = `
resource "tencentcloud_scf_namespace" "foo" {
namespace = "ci-test-scf"
}

resource "tencentcloud_scf_function" "foo" {
namespace = tencentcloud_scf_namespace.foo.id
namespace = "` + defaultScfNamespace + `"
name = "%s"
handler = "first.do_it_first"
runtime = "Python3.6"
enable_public_net = true

zip_file = "%s"
}
Expand All @@ -180,6 +178,7 @@ resource "tencentcloud_scf_function" "foo" {
handler = "first.do_it_first"
runtime = "Python3.6"
description = "test"
enable_public_net = true

zip_file = "%s"
}
Expand All @@ -194,6 +193,7 @@ resource "tencentcloud_scf_function" "foo" {
name = "%s"
handler = "first.do_it_first"
runtime = "Python3.6"
enable_public_net = true

zip_file = "%s"

Expand Down
2 changes: 2 additions & 0 deletions tencentcloud/data_source_tc_scf_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "tencentcloud_scf_function" "foo" {
name = "%s"
handler = "first.do_it_first"
runtime = "Python3.6"
enable_public_net = true

zip_file = "%s"
}
Expand All @@ -70,6 +71,7 @@ resource "tencentcloud_scf_function" "foo" {
name = "%s"
handler = "first.do_it_first"
runtime = "Python3.6"
enable_public_net = true

zip_file = "%s"
}
Expand Down
12 changes: 4 additions & 8 deletions tencentcloud/data_source_tc_scf_namespaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ func TestAccDataSourceTencentCloudScfNamespaces_basic(t *testing.T) {
Config: TestAccDataSourceTencentCloudScfNamespaces,
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID("data.tencentcloud_scf_namespaces.foo"),
resource.TestCheckResourceAttr("data.tencentcloud_scf_namespaces.foo", "namespace", "ci-test-scf"),
resource.TestCheckResourceAttr("data.tencentcloud_scf_namespaces.foo", "namespace", defaultScfNamespace),
resource.TestMatchResourceAttr("data.tencentcloud_scf_namespaces.foo", "namespaces.#", regexp.MustCompile(`^[1-9]\d*$`)),
resource.TestMatchResourceAttr("data.tencentcloud_scf_namespaces.foo", "namespaces.0.namespace", regexp.MustCompile(`ci-test-scf`)),
resource.TestCheckResourceAttr("data.tencentcloud_scf_namespaces.foo", "namespaces.0.namespace", defaultScfNamespace),
resource.TestCheckResourceAttrSet("data.tencentcloud_scf_namespaces.foo", "namespaces.0.create_time"),
resource.TestCheckResourceAttrSet("data.tencentcloud_scf_namespaces.foo", "namespaces.0.modify_time"),
resource.TestCheckResourceAttrSet("data.tencentcloud_scf_namespaces.foo", "namespaces.0.type"),
Expand Down Expand Up @@ -53,18 +53,14 @@ func TestAccDataSourceTencentCloudScfNamespaces_desc(t *testing.T) {
}

const TestAccDataSourceTencentCloudScfNamespaces = `
resource "tencentcloud_scf_namespace" "foo" {
namespace = "ci-test-scf"
}

data "tencentcloud_scf_namespaces" "foo" {
namespace = tencentcloud_scf_namespace.foo.id
namespace = "` + defaultScfNamespace + `"
}
`

const TestAccDataSourceTencentCloudScfNamespacesDesc = `
resource "tencentcloud_scf_namespace" "foo" {
namespace = "ci-test-scf"
namespace = "ci-test-desc-namespace"
description = "test"
}

Expand Down
Loading