mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-06 00:56:43 +00:00
![sarunask](/assets/img/avatar_default.png)
* Initial commit * Adding google_cloudfunction_function resource * Some FMT updates * Working Cloud Function Create/Delete/Get Create is limited to gs:// source now. * Fixed tests import * Terraform now is able to apply and destroy function * Fully working Basic test * Added: 1. Allowed region check 2. readTimeout helper * Found better solution for conflicting values * Adding description * Adding full basic test * dded Update functionality * Made few more optional params * Added test for Labels * Added update tests * Added storage_* members and made function source deploy from storage bucket object * Adding comments * Adding tests for PubSub * Adding tests for Bucket * Adding Data provider * Fixing bug which allowed to miss error * Amending Operation retrieval * Fixing vet errors and vendoring cloudfunctions/v1 * Fixing according to comments * Fixing according to comments round #2 * Fixing tabs to space * Fixing tabs to space and some comments #3 * Re-done update to include labels in one update with others * Adding back default values. In case of such scenario, when user creates function with some values for "timeout" or "available_memory_mb", and then disables those attributes. Terraform plan then gives: No changes. Infrastructure is up-to-date. This is an error. By adding const we would avoid this error. * Fixed MixedCase and more tabs
46 lines
1021 B
Go
46 lines
1021 B
Go
package google
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
)
|
|
|
|
func dataSourceGoogleCloudFunctionsFunction() *schema.Resource {
|
|
// Generate datasource schema from resource
|
|
dsSchema := datasourceSchemaFromResourceSchema(resourceCloudFunctionsFunction().Schema)
|
|
|
|
// Set 'Required' schema elements
|
|
addRequiredFieldsToSchema(dsSchema, "name")
|
|
|
|
// Set 'Optional' schema elements
|
|
addOptionalFieldsToSchema(dsSchema, "project", "region")
|
|
|
|
return &schema.Resource{
|
|
Read: dataSourceGoogleCloudFunctionsFunctionRead,
|
|
Schema: dsSchema,
|
|
}
|
|
}
|
|
|
|
func dataSourceGoogleCloudFunctionsFunctionRead(d *schema.ResourceData, meta interface{}) error {
|
|
config := meta.(*Config)
|
|
|
|
project, err := getProject(d, config)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
region, err := getRegion(d, config)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
cloudFuncId := &cloudFunctionId{
|
|
Project: project,
|
|
Region: region,
|
|
Name: d.Get("name").(string),
|
|
}
|
|
|
|
d.SetId(cloudFuncId.terraformId())
|
|
|
|
return resourceCloudFunctionsRead(d, meta)
|
|
}
|