Skip to content

Commit

Permalink
add can_delete optional param
Browse files Browse the repository at this point in the history
  • Loading branch information
coffeepac committed Dec 4, 2015
1 parent 04d1ef4 commit 729c081
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builtin/providers/google/resource_bigquery_dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ func resourceBigQueryDataset() *schema.Resource {
return &schema.Resource{
Create: resourceBigQueryDatasetCreate,
Read: resourceBigQueryDatasetRead,
Update: resourceBigQueryDatasetUpdate,
Delete: resourceBigQueryDatasetDelete,

Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -64,6 +65,11 @@ func resourceBigQueryDatasetRead(d *schema.ResourceData, meta interface{}) error
return nil
}

// basically a no-op from terraform's point of view. but it allows can_delete
// setting to be altered
func resourceBigQueryDatasetUpdate(d *schema.ResourceData, meta interface{}) error {
return nil
}

func resourceBigQueryDatasetDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
Expand Down
1 change: 1 addition & 0 deletions builtin/providers/google/resource_bigquery_dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ func testAccBigQueryDatasetExists(n string) resource.TestCheckFunc {
const testAccBigQueryDataset = `
resource "google_bigquery_dataset" "foobar" {
name = "foobar"
can_delete = true
}`
6 changes: 6 additions & 0 deletions builtin/providers/google/resource_bigquery_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ func resourceBigQueryTable() *schema.Resource {
Create: resourceBigQueryTableCreate,
Read: resourceBigQueryTableRead,
Delete: resourceBigQueryTableDelete,
Update: resourceBigQueryTableUpdate,

Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Expand Down Expand Up @@ -68,6 +69,11 @@ func resourceBigQueryTableRead(d *schema.ResourceData, meta interface{}) error {
return nil
}

// basically a no-op from terraform's point of view. but it allows can_delete
// setting to be altered
func resourceBigQueryTableUpdate(d *schema.ResourceData, meta interface{}) error {
return nil
}

func resourceBigQueryTableDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
Expand Down
2 changes: 2 additions & 0 deletions builtin/providers/google/resource_bigquery_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ func testAccBigQueryTableExists(n string) resource.TestCheckFunc {
const testAccBigQueryTable = `
resource "google_bigquery_dataset" "foobar" {
name = "foobar"
can_delete = true
}
resource "google_bigquery_table" "foobar" {
name = "foobar"
datasetId = "${google_bigquery_dataset.foobar.name}"
can_delete = true
}`

0 comments on commit 729c081

Please sign in to comment.