mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-08-31 06:10:20 +00:00
30 lines
718 B
Go
30 lines
718 B
Go
![]() |
package google
|
||
|
|
||
|
import (
|
||
|
"github.com/hashicorp/terraform/helper/schema"
|
||
|
)
|
||
|
|
||
|
func dataSourceGoogleComputeSslPolicy() *schema.Resource {
|
||
|
// Generate datasource schema from resource
|
||
|
dsSchema := datasourceSchemaFromResourceSchema(resourceComputeSslPolicy().Schema)
|
||
|
|
||
|
// Set 'Required' schema elements
|
||
|
addRequiredFieldsToSchema(dsSchema, "name")
|
||
|
|
||
|
// Set 'Optional' schema elements
|
||
|
addOptionalFieldsToSchema(dsSchema, "project")
|
||
|
|
||
|
return &schema.Resource{
|
||
|
Read: datasourceComputeSslPolicyRead,
|
||
|
Schema: dsSchema,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func datasourceComputeSslPolicyRead(d *schema.ResourceData, meta interface{}) error {
|
||
|
policyName := d.Get("name").(string)
|
||
|
|
||
|
d.SetId(policyName)
|
||
|
|
||
|
return resourceComputeSslPolicyRead(d, meta)
|
||
|
}
|