Hey Everyone! I am writing acceptance tests to a Custom Provider, and this resource in particular needs another resource to be created first in order to be created. I tried writing it like:
func TestAccVodSourceResource(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// Create and Read testing
{
Config: `
resource "awsmt_source_location" "test_source_location_vod"{
source_location_name = "source_location_vod"
http_configuration = {
hc_base_url = "https://ott-mediatailor-test.s3.eu-central-1.amazonaws.com/"
}
}
resource "awsmt_vod_source" "test" {
http_package_configurations = [{
path = "/"
source_group = "default"
type = "HLS"
}]
source_location_name = awsmt_vod_source.test.test_vod_source_name.source_location_name
vod_source_name = "vod_source_example"
}
data "awsmt_vod_source" "data_test" {
source_location_name = source_location_vod
vod_source_name = awsmt_vod_source.test.test_vod_source_name.source_location_name
}
output "vod_source_out" {
value = data.awsmt_vod_source.data_test
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("awsmt_vod_source.test", "source_location_name", "test_source_location_vod"),
resource.TestCheckResourceAttr("awsmt_vod_source.test", "vod_source_name", "vod_source_example"),
resource.TestCheckResourceAttr("awsmt_vod_source.test", "http_package_configurations.0.path", "/"),
),
},
bur I keep getting the following error:
resource_vod_source_test.go:9: Resource specified by ResourceName couldn’t be found: awsmt_vod_source.testawsmt_source_location.test_source_location_vod
how can I create two resources on the same config step?