-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from yanndegat/renamecloudresources
mv ovh_cloud_* -> ovh_cloud_project_*
- Loading branch information
Showing
33 changed files
with
659 additions
and
704 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package ovh | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccCloudProjectRegionDataSource_basic(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheckCloud(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCloudProjectRegionDatasourceConfig, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.0", "name"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.0", "services.#"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.1", "name"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.1", "services.#"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.2", "name"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.2", "services.#"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccCloudProjectRegionDataSourceDeprecated_basic(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheckCloud(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCloudProjectRegionDatasourceDeprecatedConfig, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.0", "name"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.0", "services.#"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.1", "name"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.1", "services.#"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.2", "name"), | ||
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_region.region_attr.2", "services.#"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
var testAccCloudProjectRegionDatasourceConfig = fmt.Sprintf(` | ||
data "ovh_cloud_project_regions" "regions" { | ||
service_name = "%s" | ||
} | ||
data "ovh_cloud_project_region" "region_attr" { | ||
count = 3 | ||
service_name = data.ovh_cloud_project_regions.regions.service_name | ||
name = element(sort(data.ovh_cloud_project_regions.regions.names), count.index) | ||
} | ||
`, os.Getenv("OVH_CLOUD_PROJECT_SERVICE_TEST")) | ||
|
||
var testAccCloudProjectRegionDatasourceDeprecatedConfig = fmt.Sprintf(` | ||
data "ovh_cloud_project_regions" "regions" { | ||
project_id = "%s" | ||
} | ||
data "ovh_cloud_project_region" "region_attr" { | ||
count = 3 | ||
project_id = data.ovh_cloud_project_regions.regions.service_name | ||
name = element(sort(data.ovh_cloud_project_regions.regions.names), count.index) | ||
} | ||
`, os.Getenv("OVH_CLOUD_PROJECT_SERVICE_TEST")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package ovh | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccCloudProjectRegionsDataSource_basic(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheckCloud(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCloudProjectRegionsDatasourceConfig, | ||
Check: resource.TestCheckResourceAttrSet("data.ovh_cloud_project_regions.regions", "names.#"), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccCloudProjectRegionsDeprecatedDataSource_basic(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheckCloud(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCloudProjectRegionsDatasourceDeprecatedConfig, | ||
Check: resource.TestCheckResourceAttrSet("data.ovh_cloud_project_regions.regions", "names.#"), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccCloudProjectRegionsDataSource_withNetworkUp(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheckCloud(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCloudProjectRegionsDatasourceConfig_withNetwork, | ||
Check: resource.TestCheckResourceAttrSet("data.ovh_cloud_project_regions.regions", "names.#"), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
var testAccCloudProjectRegionsDatasourceConfig = fmt.Sprintf(` | ||
data "ovh_cloud_project_regions" "regions" { | ||
service_name = "%s" | ||
} | ||
`, os.Getenv("OVH_CLOUD_PROJECT_SERVICE_TEST")) | ||
|
||
var testAccCloudProjectRegionsDatasourceDeprecatedConfig = fmt.Sprintf(` | ||
data "ovh_cloud_project_regions" "regions" { | ||
project_id = "%s" | ||
} | ||
`, os.Getenv("OVH_CLOUD_PROJECT_SERVICE_TEST")) | ||
|
||
var testAccCloudProjectRegionsDatasourceConfig_withNetwork = fmt.Sprintf(` | ||
data "ovh_cloud_project_regions" "regions" { | ||
service_name = "%s" | ||
has_services_up = ["network"] | ||
} | ||
`, os.Getenv("OVH_CLOUD_PROJECT_SERVICE_TEST")) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.