Skip to content

Commit

Permalink
Correct Cloud Run DomainMapping namespace in encoder
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
rileykarson authored and modular-magician committed Oct 10, 2019
1 parent 0263d6f commit 03528f4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 162 deletions.
103 changes: 25 additions & 78 deletions google/resource_app_engine_standard_app_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ func resourceAppEngineStandardAppVersion() *schema.Resource {
},
},
},
"instance_class": {
Type: schema.TypeString,
Optional: true,
},
"libraries": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -241,11 +237,6 @@ func resourceAppEngineStandardAppVersion() *schema.Resource {
Optional: true,
Default: false,
},
"delete_service_on_destroy": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"project": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -314,12 +305,6 @@ func resourceAppEngineStandardAppVersionCreate(d *schema.ResourceData, meta inte
} else if v, ok := d.GetOkExists("entrypoint"); !isEmptyValue(reflect.ValueOf(entrypointProp)) && (ok || !reflect.DeepEqual(v, entrypointProp)) {
obj["entrypoint"] = entrypointProp
}
instanceClassProp, err := expandAppEngineStandardAppVersionInstanceClass(d.Get("instance_class"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("instance_class"); !isEmptyValue(reflect.ValueOf(instanceClassProp)) && (ok || !reflect.DeepEqual(v, instanceClassProp)) {
obj["instanceClass"] = instanceClassProp
}

lockName, err := replaceVars(d, config, "apps/{{project}}/services/{{service}}")
if err != nil {
Expand Down Expand Up @@ -392,9 +377,6 @@ func resourceAppEngineStandardAppVersionRead(d *schema.ResourceData, meta interf
if _, ok := d.GetOk("noop_on_destroy"); !ok {
d.Set("noop_on_destroy", false)
}
if _, ok := d.GetOk("delete_service_on_destroy"); !ok {
d.Set("delete_service_on_destroy", false)
}

if err := d.Set("project", project); err != nil {
return fmt.Errorf("Error reading StandardAppVersion: %s", err)
Expand Down Expand Up @@ -485,12 +467,6 @@ func resourceAppEngineStandardAppVersionUpdate(d *schema.ResourceData, meta inte
} else if v, ok := d.GetOkExists("entrypoint"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, entrypointProp)) {
obj["entrypoint"] = entrypointProp
}
instanceClassProp, err := expandAppEngineStandardAppVersionInstanceClass(d.Get("instance_class"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("instance_class"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, instanceClassProp)) {
obj["instanceClass"] = instanceClassProp
}

lockName, err := replaceVars(d, config, "apps/{{project}}/services/{{service}}")
if err != nil {
Expand Down Expand Up @@ -529,7 +505,6 @@ func resourceAppEngineStandardAppVersionUpdate(d *schema.ResourceData, meta inte
}

func resourceAppEngineStandardAppVersionDelete(d *schema.ResourceData, meta interface{}) error {

if d.Get("noop_on_destroy") == true {
log.Printf("[DEBUG] Keeping the StandardAppVersion %q", d.Id())
return nil
Expand All @@ -548,58 +523,35 @@ func resourceAppEngineStandardAppVersionDelete(d *schema.ResourceData, meta inte
mutexKV.Lock(lockName)
defer mutexKV.Unlock(lockName)

if d.Get("delete_service_on_destroy") == true {
url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/services/{{service}}")
if err != nil {
return err
}
var obj map[string]interface{}
log.Printf("[DEBUG] Deleting Service %q", d.Id())
res, err := sendRequestWithTimeout(config, "DELETE", project, url, obj, d.Timeout(schema.TimeoutDelete))
if err != nil {
return handleNotFoundError(err, d, "Service")
}
op := &appengine.Operation{}
err = Convert(res, op)
if err != nil {
return err
}
err = appEngineOperationWaitTime(
config.clientAppEngine, op, project, "Deleting Service",
int(d.Timeout(schema.TimeoutDelete).Minutes()))
url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/services/{{service}}/versions/{{version_id}}")
if err != nil {
return err
}

if err != nil {
return err
}
log.Printf("[DEBUG] Finished deleting Service %q: %#v", d.Id(), res)
return nil
} else {
url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/services/{{service}}/versions/{{version_id}}")
if err != nil {
return err
}
var obj map[string]interface{}
log.Printf("[DEBUG] Deleting StandardAppVersion %q", d.Id())
res, err := sendRequestWithTimeout(config, "DELETE", project, url, obj, d.Timeout(schema.TimeoutDelete))
if err != nil {
return handleNotFoundError(err, d, "StandardAppVersion")
}
op := &appengine.Operation{}
err = Convert(res, op)
if err != nil {
return err
}
err = appEngineOperationWaitTime(
config.clientAppEngine, op, project, "Deleting StandardAppVersion",
int(d.Timeout(schema.TimeoutDelete).Minutes()))
var obj map[string]interface{}
log.Printf("[DEBUG] Deleting StandardAppVersion %q", d.Id())

if err != nil {
return err
}
log.Printf("[DEBUG] Finished deleting StandardAppVersion %q: %#v", d.Id(), res)
return nil
res, err := sendRequestWithTimeout(config, "DELETE", project, url, obj, d.Timeout(schema.TimeoutDelete))
if err != nil {
return handleNotFoundError(err, d, "StandardAppVersion")
}

op := &appengine.Operation{}
err = Convert(res, op)
if err != nil {
return err
}

err = appEngineOperationWaitTime(
config.clientAppEngine, op, project, "Deleting StandardAppVersion",
int(d.Timeout(schema.TimeoutDelete).Minutes()))

if err != nil {
return err
}

log.Printf("[DEBUG] Finished deleting StandardAppVersion %q: %#v", d.Id(), res)
return nil
}

func resourceAppEngineStandardAppVersionImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
Expand All @@ -621,7 +573,6 @@ func resourceAppEngineStandardAppVersionImport(d *schema.ResourceData, meta inte

// Explicitly set virtual fields to default values on import
d.Set("noop_on_destroy", false)
d.Set("delete_service_on_destroy", false)

return []*schema.ResourceData{d}, nil
}
Expand Down Expand Up @@ -1165,7 +1116,3 @@ func expandAppEngineStandardAppVersionEntrypoint(v interface{}, d TerraformResou
func expandAppEngineStandardAppVersionEntrypointShell(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandAppEngineStandardAppVersionInstanceClass(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestAccAppEngineStandardAppVersion_appEngineStandardAppVersionExample(t *te
ResourceName: "google_app_engine_standard_app_version.version_id",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"threadsafe", "env_variables", "deployment", "entrypoint", "instance_class", "noop_on_destroy"},
ImportStateVerifyIgnore: []string{"threadsafe", "env_variables", "deployment", "entrypoint", "noop_on_destroy"},
},
},
})
Expand Down Expand Up @@ -79,43 +79,6 @@ resource "google_app_engine_standard_app_version" "version_id" {
port = "8080"
}
}
resource "google_app_engine_standard_app_version" "myapp_v1" {
version_id = "v1"
service = "myapp"
runtime = "nodejs10"
delete_service_on_destroy = true
entrypoint {
shell = "node ./app.js"
}
deployment {
zip {
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/hello-world.zip"
}
}
env_variables = {
port = "8080"
}
depends_on = ["google_storage_bucket_object.object"]
}
resource "google_app_engine_standard_app_version" "myapp_v2" {
version_id = "v2"
service = "myapp"
runtime = "nodejs10"
entrypoint {
shell = "node ./app.js"
}
deployment {
zip {
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/hello-world.zip"
}
}
env_variables = {
port = "8080"
}
depends_on = ["google_app_engine_standard_app_version.myapp_v1"]
}
`, context)
}
Expand Down
44 changes: 0 additions & 44 deletions website/docs/r/app_engine_standard_app_version.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -68,43 +68,6 @@ resource "google_app_engine_standard_app_version" "version_id" {
port = "8080"
}
}
resource "google_app_engine_standard_app_version" "myapp_v1" {
version_id = "v1"
service = "myapp"
runtime = "nodejs10"
delete_service_on_destroy = true
entrypoint {
shell = "node ./app.js"
}
deployment {
zip {
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/hello-world.zip"
}
}
env_variables = {
port = "8080"
}
depends_on = ["google_storage_bucket_object.object"]
}
resource "google_app_engine_standard_app_version" "myapp_v2" {
version_id = "v2"
service = "myapp"
runtime = "nodejs10"
entrypoint {
shell = "node ./app.js"
}
deployment {
zip {
source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/hello-world.zip"
}
}
env_variables = {
port = "8080"
}
depends_on = ["google_app_engine_standard_app_version.myapp_v1"]
}
```

Expand Down Expand Up @@ -155,12 +118,6 @@ The following arguments are supported:
(Optional)
The entrypoint for the application. Structure is documented below.

* `instance_class` -
(Optional)
Instance class that is used to run this version. Valid values are
AutomaticScaling F1, F2, F4, F4_1G
(Only AutomaticScaling is supported at the moment)

* `service` -
(Optional)
AppEngine service resource
Expand All @@ -169,7 +126,6 @@ The following arguments are supported:
If it is not provided, the provider project is used.

* `noop_on_destroy` - (Optional) If set to `true`, the application version will not be deleted.
* `delete_service_on_destroy` - (Optional) If set to `true`, the service will be deleted if it is the last version.

The `handlers` block supports:

Expand Down
1 change: 0 additions & 1 deletion website/docs/r/cloudfunctions_function.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ for Cloud Functions.
## Example Usage

Secured function with a user allowed to invoke:

```hcl
resource "google_storage_bucket" "bucket" {
name = "test-bucket"
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/sql_database_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ The required `settings` block supports:
* `crash_safe_replication` - (Optional) Specific to read instances, indicates
when crash-safe replication flags are enabled.

* `disk_autoresize` - (Optional, Second Generation, Default: `true`) Configuration to increase storage size automatically.
* `disk_autoresize` - (Optional, Second Generation, Default: `true`) Configuration to increase storage size automatically. Note that future `terraform apply` calls will attempt to resize the disk to the value specified in `disk_size` - if this is set, do not set `disk_size`.

* `disk_size` - (Optional, Second Generation, Default: `10`) The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased.

Expand Down

0 comments on commit 03528f4

Please sign in to comment.