terraform-provider-greenhost/digitalocean/datasource_digitalocean_app.go

56 lines
1.3 KiB
Go
Raw Normal View History

package digitalocean
import (
upgrade provider to use terraform-plugin-sdk v2 (#492) * upgrade terraform-plugin-sdk and `go mod vendor` * Update digitalocean/datasource_digitalocean_image_test.go Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com> * Update digitalocean/datasource_digitalocean_kubernetes_cluster_test.go Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com> * Update digitalocean/datasource_digitalocean_vpc_test.go Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com> * Update digitalocean/datasource_digitalocean_vpc_test.go Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com> * go fmt * fix droplet_id to be of the right type * fix digitalocean_project resource * fix creation order in digitalocean_certificate test * fix digitalocean_container_registry data source tes * Port new changes to v2. * Port all tests to resource.ParallelTest * Fix KubernetesProviderInteroperability test. * Fix TestAccDigitalOceanKubernetesCluster_UpgradeVersion * Fix firewall panic s/create_at/created_at/ * Fix TestAccDigitalOceanDroplet_Basic: Droplets now have private networking by default. * Fix TestAccDataSourceDigitalOceanDomain_Basic * Fix TestAccDataSourceDigitalOceanDropletSnapshot tests. * Fix TestAccDataSourceDigitalOceanSSHKey_Basic * Fix TestAccDataSourceDigitalOceanVolumeSnapshot tests. * Fix TestAccDataSourceDigitalOceanVolume tests. * Fix TestAccDataSourceDigitalOceanRecord_Basic * Fix TestAccDataSourceDigitalOceanProject_NonDefaultProject * Fix TestAccDigitalOceanImage_PublicSlug * Fix TestAccDataSourceDigitalOceanImages_Basic via bug in imageSchema() * go mod tidy * Fix TestAccDataSourceDigitalOceanDroplet tests. * Fix TestAccDataSourceDigitalOceanVPC_ByName * Fix TestAccDataSourceDigitalOceanTag_Basic * Fix TestAccDataSourceDigitalOceanTags_Basic * Ensure versions are set in DBaaS tests. * Fix TestAccDataSourceDigitalOceanApp_Basic * Fix non-set related issues with TestAccDataSourceDigitalOceanLoadBalancer tests. * Fix TestAccDataSourceDigitalOceanKubernetesCluster_Basic * Remove testAccDigitalOceanKubernetesConfigWithEmptyNodePool: Empty node pools are no longer supported. * Fix TestAccDigitalOceanProject_WithManyResources. * Fix TestAccDigitalOceanProject_UpdateFromDropletToSpacesResource * vendor set helpers from AWS provider * Fix TestAccDigitalOceanFloatingIP_Droplet. * Fix CDN panic. * fix TestAccDigitalOceanSpacesBucket_LifecycleBasic using setutil helpers * vendor set helpers from AWS provider * fix TestAccDigitalOceanSpacesBucket_LifecycleBasic using setutil helpers * Fix load balancer tests using setutil helpers. * Fix K8s tests using setutil helpers. * Fix TestAccDigitalOceanApp_Envs using setutil helpers. * Fix TestAccDigitalOceanSpacesBucket_LifecycleExpireMarkerOnly using setutil helpers. * Fix TestAccDigitalOceanFloatingIPAssignment_createBeforeDestroy * fix remaining TypeSet tests using setutil * Registry test can not run in parallel. One per account. * Fix TestAccDigitalOceanProject_UpdateWithDropletResource * Fix replica tests. * go mod tidy Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com> Co-authored-by: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
2020-10-16 19:50:20 +00:00
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func dataSourceDigitalOceanApp() *schema.Resource {
return &schema.Resource{
Read: dataSourceDigitalOceanAppRead,
Schema: map[string]*schema.Schema{
"app_id": {
Type: schema.TypeString,
Required: true,
},
"spec": {
Type: schema.TypeList,
Computed: true,
Description: "A DigitalOcean App Platform Spec",
Elem: &schema.Resource{
Schema: appSpecSchema(),
},
},
"default_ingress": {
Type: schema.TypeString,
Computed: true,
Description: "The default URL to access the App",
},
"live_url": {
Type: schema.TypeString,
Computed: true,
},
"active_deployment_id": {
Type: schema.TypeString,
Computed: true,
Description: "The ID the App's currently active deployment",
},
"updated_at": {
Type: schema.TypeString,
Computed: true,
Description: "The date and time of when the App was last updated",
},
"created_at": {
Type: schema.TypeString,
Computed: true,
Description: "The date and time of when the App was created",
},
},
}
}
func dataSourceDigitalOceanAppRead(d *schema.ResourceData, meta interface{}) error {
d.SetId(d.Get("app_id").(string))
return resourceDigitalOceanAppRead(d, meta)
}