From 530506a07a1aacb7adfd3450be90e03323947958 Mon Sep 17 00:00:00 2001 From: megan07 Date: Fri, 6 Sep 2019 14:43:23 +0000 Subject: [PATCH] Add app engine domain mappings resource Signed-off-by: Modular Magician --- google/provider.go | 5 +- google/resource_app_engine_domain_mapping.go | 456 ++++++++++++++++++ ...pp_engine_domain_mapping_generated_test.go | 87 ++++ ...resource_app_engine_domain_mapping_test.go | 64 +++ .../r/app_engine_domain_mapping.html.markdown | 149 ++++++ website/google.erb | 3 + 6 files changed, 762 insertions(+), 2 deletions(-) create mode 100644 google/resource_app_engine_domain_mapping.go create mode 100644 google/resource_app_engine_domain_mapping_generated_test.go create mode 100644 google/resource_app_engine_domain_mapping_test.go create mode 100644 website/docs/r/app_engine_domain_mapping.html.markdown diff --git a/google/provider.go b/google/provider.go index 89a77c08a9b..2a51a49d308 100644 --- a/google/provider.go +++ b/google/provider.go @@ -414,9 +414,9 @@ func Provider() terraform.ResourceProvider { return provider } -// Generated resources: 77 +// Generated resources: 78 // Generated IAM resources: 18 -// Total generated resources: 95 +// Total generated resources: 96 func ResourceMap() map[string]*schema.Resource { resourceMap, _ := ResourceMapWithErrors() return resourceMap @@ -428,6 +428,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) { "google_access_context_manager_access_policy": resourceAccessContextManagerAccessPolicy(), "google_access_context_manager_access_level": resourceAccessContextManagerAccessLevel(), "google_access_context_manager_service_perimeter": resourceAccessContextManagerServicePerimeter(), + "google_app_engine_domain_mapping": resourceAppEngineDomainMapping(), "google_app_engine_firewall_rule": resourceAppEngineFirewallRule(), "google_app_engine_standard_app_version": resourceAppEngineStandardAppVersion(), "google_bigquery_dataset": resourceBigQueryDataset(), diff --git a/google/resource_app_engine_domain_mapping.go b/google/resource_app_engine_domain_mapping.go new file mode 100644 index 00000000000..23d852a02b3 --- /dev/null +++ b/google/resource_app_engine_domain_mapping.go @@ -0,0 +1,456 @@ +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package google + +import ( + "fmt" + "log" + "reflect" + "strings" + "time" + + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" + "google.golang.org/api/appengine/v1" +) + +func sslSettingsDiffSuppress(k, old, new string, d *schema.ResourceData) bool { + // If certificate id is empty, and ssl management type is `MANUAL`, then + // ssl settings will not be configured, and ssl_settings block is not returned + + if k == "ssl_settings.#" && + old == "0" && new == "1" && + d.Get("ssl_settings.0.certificate_id") == "" && + d.Get("ssl_settings.0.ssl_management_type") == "MANUAL" { + return true + } + + return false +} + +func resourceAppEngineDomainMapping() *schema.Resource { + return &schema.Resource{ + Create: resourceAppEngineDomainMappingCreate, + Read: resourceAppEngineDomainMappingRead, + Update: resourceAppEngineDomainMappingUpdate, + Delete: resourceAppEngineDomainMappingDelete, + + Importer: &schema.ResourceImporter{ + State: resourceAppEngineDomainMappingImport, + }, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(4 * time.Minute), + Update: schema.DefaultTimeout(4 * time.Minute), + Delete: schema.DefaultTimeout(4 * time.Minute), + }, + + Schema: map[string]*schema.Schema{ + "domain_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "override_strategy": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"STRICT", "OVERRIDE", ""}, false), + Default: "STRICT", + }, + "ssl_settings": { + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: sslSettingsDiffSuppress, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "certificate_id": { + Type: schema.TypeString, + Optional: true, + }, + "ssl_management_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"AUTOMATIC", "MANUAL", ""}, false), + }, + "pending_managed_certificate_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "resource_records": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Optional: true, + }, + "rrdata": { + Type: schema.TypeString, + Optional: true, + }, + "type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"A", "AAAA", "CNAME", ""}, false), + }, + }, + }, + }, + "project": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + } +} + +func resourceAppEngineDomainMappingCreate(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + + obj := make(map[string]interface{}) + sslSettingsProp, err := expandAppEngineDomainMappingSslSettings(d.Get("ssl_settings"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("ssl_settings"); !isEmptyValue(reflect.ValueOf(sslSettingsProp)) && (ok || !reflect.DeepEqual(v, sslSettingsProp)) { + obj["sslSettings"] = sslSettingsProp + } + idProp, err := expandAppEngineDomainMappingDomainName(d.Get("domain_name"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("domain_name"); !isEmptyValue(reflect.ValueOf(idProp)) && (ok || !reflect.DeepEqual(v, idProp)) { + obj["id"] = idProp + } + + url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/domainMappings") + if err != nil { + return err + } + + log.Printf("[DEBUG] Creating new DomainMapping: %#v", obj) + project, err := getProject(d, config) + if err != nil { + return err + } + res, err := sendRequestWithTimeout(config, "POST", project, url, obj, d.Timeout(schema.TimeoutCreate)) + if err != nil { + return fmt.Errorf("Error creating DomainMapping: %s", err) + } + + // Store the ID now + id, err := replaceVars(d, config, "{{domain_name}}") + if err != nil { + return fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + op := &appengine.Operation{} + err = Convert(res, op) + if err != nil { + return err + } + + waitErr := appEngineOperationWaitTime( + config.clientAppEngine, op, project, "Creating DomainMapping", + int(d.Timeout(schema.TimeoutCreate).Minutes())) + + if waitErr != nil { + // The resource didn't actually create + d.SetId("") + return fmt.Errorf("Error waiting to create DomainMapping: %s", waitErr) + } + + log.Printf("[DEBUG] Finished creating DomainMapping %q: %#v", d.Id(), res) + + return resourceAppEngineDomainMappingRead(d, meta) +} + +func resourceAppEngineDomainMappingRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + + url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/domainMappings/{{domain_name}}") + if err != nil { + return err + } + + project, err := getProject(d, config) + if err != nil { + return err + } + res, err := sendRequest(config, "GET", project, url, nil) + if err != nil { + return handleNotFoundError(err, d, fmt.Sprintf("AppEngineDomainMapping %q", d.Id())) + } + + if err := d.Set("project", project); err != nil { + return fmt.Errorf("Error reading DomainMapping: %s", err) + } + + if err := d.Set("name", flattenAppEngineDomainMappingName(res["name"], d)); err != nil { + return fmt.Errorf("Error reading DomainMapping: %s", err) + } + if err := d.Set("ssl_settings", flattenAppEngineDomainMappingSslSettings(res["sslSettings"], d)); err != nil { + return fmt.Errorf("Error reading DomainMapping: %s", err) + } + if err := d.Set("resource_records", flattenAppEngineDomainMappingResourceRecords(res["resourceRecords"], d)); err != nil { + return fmt.Errorf("Error reading DomainMapping: %s", err) + } + if err := d.Set("domain_name", flattenAppEngineDomainMappingDomainName(res["id"], d)); err != nil { + return fmt.Errorf("Error reading DomainMapping: %s", err) + } + + return nil +} + +func resourceAppEngineDomainMappingUpdate(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + + project, err := getProject(d, config) + if err != nil { + return err + } + + obj := make(map[string]interface{}) + sslSettingsProp, err := expandAppEngineDomainMappingSslSettings(d.Get("ssl_settings"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("ssl_settings"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sslSettingsProp)) { + obj["sslSettings"] = sslSettingsProp + } + + url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/domainMappings/{{domain_name}}") + if err != nil { + return err + } + + log.Printf("[DEBUG] Updating DomainMapping %q: %#v", d.Id(), obj) + updateMask := []string{} + + if d.HasChange("ssl_settings") { + updateMask = append(updateMask, "ssl_settings.certificate_id,ssl_settings.ssl_management_type") + } + // updateMask is a URL parameter but not present in the schema, so replaceVars + // won't set it + url, err = addQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) + if err != nil { + return err + } + res, err := sendRequestWithTimeout(config, "PATCH", project, url, obj, d.Timeout(schema.TimeoutUpdate)) + + if err != nil { + return fmt.Errorf("Error updating DomainMapping %q: %s", d.Id(), err) + } + + op := &appengine.Operation{} + err = Convert(res, op) + if err != nil { + return err + } + + err = appEngineOperationWaitTime( + config.clientAppEngine, op, project, "Updating DomainMapping", + int(d.Timeout(schema.TimeoutUpdate).Minutes())) + + if err != nil { + return err + } + + return resourceAppEngineDomainMappingRead(d, meta) +} + +func resourceAppEngineDomainMappingDelete(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + + project, err := getProject(d, config) + if err != nil { + return err + } + + url, err := replaceVars(d, config, "{{AppEngineBasePath}}apps/{{project}}/domainMappings/{{domain_name}}") + if err != nil { + return err + } + + var obj map[string]interface{} + log.Printf("[DEBUG] Deleting DomainMapping %q", d.Id()) + + res, err := sendRequestWithTimeout(config, "DELETE", project, url, obj, d.Timeout(schema.TimeoutDelete)) + if err != nil { + return handleNotFoundError(err, d, "DomainMapping") + } + + op := &appengine.Operation{} + err = Convert(res, op) + if err != nil { + return err + } + + err = appEngineOperationWaitTime( + config.clientAppEngine, op, project, "Deleting DomainMapping", + int(d.Timeout(schema.TimeoutDelete).Minutes())) + + if err != nil { + return err + } + + log.Printf("[DEBUG] Finished deleting DomainMapping %q: %#v", d.Id(), res) + return nil +} + +func resourceAppEngineDomainMappingImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + config := meta.(*Config) + if err := parseImportId([]string{ + "(?P[^/]+)", + }, d, config); err != nil { + return nil, err + } + + // Replace import id for the resource id + id, err := replaceVars(d, config, "{{domain_name}}") + if err != nil { + return nil, fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + return []*schema.ResourceData{d}, nil +} + +func flattenAppEngineDomainMappingName(v interface{}, d *schema.ResourceData) interface{} { + return v +} + +func flattenAppEngineDomainMappingSslSettings(v interface{}, d *schema.ResourceData) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["certificate_id"] = + flattenAppEngineDomainMappingSslSettingsCertificateId(original["certificateId"], d) + transformed["ssl_management_type"] = + flattenAppEngineDomainMappingSslSettingsSslManagementType(original["sslManagementType"], d) + transformed["pending_managed_certificate_id"] = + flattenAppEngineDomainMappingSslSettingsPendingManagedCertificateId(original["pendingManagedCertificateId"], d) + return []interface{}{transformed} +} +func flattenAppEngineDomainMappingSslSettingsCertificateId(v interface{}, d *schema.ResourceData) interface{} { + return v +} + +func flattenAppEngineDomainMappingSslSettingsSslManagementType(v interface{}, d *schema.ResourceData) interface{} { + return v +} + +func flattenAppEngineDomainMappingSslSettingsPendingManagedCertificateId(v interface{}, d *schema.ResourceData) interface{} { + return v +} + +func flattenAppEngineDomainMappingResourceRecords(v interface{}, d *schema.ResourceData) interface{} { + if v == nil { + return v + } + l := v.([]interface{}) + transformed := make([]interface{}, 0, len(l)) + for _, raw := range l { + original := raw.(map[string]interface{}) + if len(original) < 1 { + // Do not include empty json objects coming back from the api + continue + } + transformed = append(transformed, map[string]interface{}{ + "name": flattenAppEngineDomainMappingResourceRecordsName(original["name"], d), + "rrdata": flattenAppEngineDomainMappingResourceRecordsRrdata(original["rrdata"], d), + "type": flattenAppEngineDomainMappingResourceRecordsType(original["type"], d), + }) + } + return transformed +} +func flattenAppEngineDomainMappingResourceRecordsName(v interface{}, d *schema.ResourceData) interface{} { + return v +} + +func flattenAppEngineDomainMappingResourceRecordsRrdata(v interface{}, d *schema.ResourceData) interface{} { + return v +} + +func flattenAppEngineDomainMappingResourceRecordsType(v interface{}, d *schema.ResourceData) interface{} { + return v +} + +func flattenAppEngineDomainMappingDomainName(v interface{}, d *schema.ResourceData) interface{} { + return v +} + +func expandAppEngineDomainMappingSslSettings(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + l := v.([]interface{}) + if len(l) == 0 || l[0] == nil { + return nil, nil + } + raw := l[0] + original := raw.(map[string]interface{}) + transformed := make(map[string]interface{}) + + transformedCertificateId, err := expandAppEngineDomainMappingSslSettingsCertificateId(original["certificate_id"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedCertificateId); val.IsValid() && !isEmptyValue(val) { + transformed["certificateId"] = transformedCertificateId + } + + transformedSslManagementType, err := expandAppEngineDomainMappingSslSettingsSslManagementType(original["ssl_management_type"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedSslManagementType); val.IsValid() && !isEmptyValue(val) { + transformed["sslManagementType"] = transformedSslManagementType + } + + transformedPendingManagedCertificateId, err := expandAppEngineDomainMappingSslSettingsPendingManagedCertificateId(original["pending_managed_certificate_id"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedPendingManagedCertificateId); val.IsValid() && !isEmptyValue(val) { + transformed["pendingManagedCertificateId"] = transformedPendingManagedCertificateId + } + + return transformed, nil +} + +func expandAppEngineDomainMappingSslSettingsCertificateId(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandAppEngineDomainMappingSslSettingsSslManagementType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandAppEngineDomainMappingSslSettingsPendingManagedCertificateId(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + +func expandAppEngineDomainMappingDomainName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} diff --git a/google/resource_app_engine_domain_mapping_generated_test.go b/google/resource_app_engine_domain_mapping_generated_test.go new file mode 100644 index 00000000000..4bf9cee5984 --- /dev/null +++ b/google/resource_app_engine_domain_mapping_generated_test.go @@ -0,0 +1,87 @@ +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package google + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAppEngineDomainMapping_appEngineDomainMappingBasicExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(10), + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAppEngineDomainMappingDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAppEngineDomainMapping_appEngineDomainMappingBasicExample(context), + }, + { + ResourceName: "google_app_engine_domain_mapping.domain_mapping", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"override_strategy"}, + }, + }, + }) +} + +func testAccAppEngineDomainMapping_appEngineDomainMappingBasicExample(context map[string]interface{}) string { + return Nprintf(` +resource "google_app_engine_domain_mapping" "domain_mapping" { + domain_name = "dm-test-%{random_suffix}.gcp.tfacc.hashicorptest.com" + + ssl_settings { + ssl_management_type = "AUTOMATIC" + } +} +`, context) +} + +func testAccCheckAppEngineDomainMappingDestroy(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_app_engine_domain_mapping" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := testAccProvider.Meta().(*Config) + + url, err := replaceVarsForTest(config, rs, "{{AppEngineBasePath}}apps/{{project}}/domainMappings/{{domain_name}}") + if err != nil { + return err + } + + _, err = sendRequest(config, "GET", "", url, nil) + if err == nil { + return fmt.Errorf("AppEngineDomainMapping still exists at %s", url) + } + } + + return nil +} diff --git a/google/resource_app_engine_domain_mapping_test.go b/google/resource_app_engine_domain_mapping_test.go new file mode 100644 index 00000000000..19f759a077c --- /dev/null +++ b/google/resource_app_engine_domain_mapping_test.go @@ -0,0 +1,64 @@ +package google + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAppEngineDomainMapping_update(t *testing.T) { + t.Parallel() + + domainName := fmt.Sprintf("tf-test-%s", acctest.RandString(10)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAppEngineDomainMappingDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAppEngineDomainMapping_basic(domainName), + }, + { + ResourceName: "google_app_engine_domain_mapping.domain_mapping", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"override_strategy"}, + }, + { + Config: testAccAppEngineDomainMapping_update(domainName), + }, + { + ResourceName: "google_app_engine_domain_mapping.domain_mapping", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"override_strategy"}, + }, + }, + }) +} + +func testAccAppEngineDomainMapping_basic(domainName string) string { + return fmt.Sprintf(` +resource "google_app_engine_domain_mapping" "domain_mapping" { + domain_name = "%s.gcp.tfacc.hashicorptest.com" + + ssl_settings { + ssl_management_type = "AUTOMATIC" + } +}`, domainName) +} + +func testAccAppEngineDomainMapping_update(domainName string) string { + return fmt.Sprintf(` +resource "google_app_engine_domain_mapping" "domain_mapping" { + domain_name = "%s.gcp.tfacc.hashicorptest.com" + + ssl_settings { + certificate_id = "" + ssl_management_type = "MANUAL" + } +}`, domainName) +} diff --git a/website/docs/r/app_engine_domain_mapping.html.markdown b/website/docs/r/app_engine_domain_mapping.html.markdown new file mode 100644 index 00000000000..3ffbb38b201 --- /dev/null +++ b/website/docs/r/app_engine_domain_mapping.html.markdown @@ -0,0 +1,149 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in +# .github/CONTRIBUTING.md. +# +# ---------------------------------------------------------------------------- +layout: "google" +page_title: "Google: google_app_engine_domain_mapping" +sidebar_current: "docs-google-app-engine-domain-mapping" +description: |- + A domain serving an App Engine application. +--- + +# google\_app\_engine\_domain\_mapping + +A domain serving an App Engine application. + + +To get more information about DomainMapping, see: + +* [API documentation](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.domainMappings) +* How-to Guides + * [Official Documentation](https://cloud.google.com/appengine/docs/standard/python/mapping-custom-domains) + + +## Example Usage - App Engine Domain Mapping Basic + + +```hcl +resource "google_app_engine_domain_mapping" "domain_mapping" { + domain_name = "dm-test-.gcp.tfacc.hashicorptest.com" + + ssl_settings { + ssl_management_type = "AUTOMATIC" + } +} +``` + +## Argument Reference + +The following arguments are supported: + + +* `domain_name` - + (Required) + Relative name of the domain serving the application. Example: example.com. + + +- - - + + +* `ssl_settings` - + (Optional) + SSL configuration for this domain. If unconfigured, this domain will not serve with SSL. Structure is documented below. + +* `override_strategy` - + (Optional) + Whether the domain creation should override any existing mappings for this domain. + By default, overrides are rejected. + +* `project` - (Optional) The ID of the project in which the resource belongs. + If it is not provided, the provider project is used. + + +The `ssl_settings` block supports: + +* `certificate_id` - + (Optional) + ID of the AuthorizedCertificate resource configuring SSL for the application. Clearing this field will + remove SSL support. + By default, a managed certificate is automatically created for every domain mapping. To omit SSL support + or to configure SSL manually, specify `SslManagementType.MANUAL` on a `CREATE` or `UPDATE` request. You must be + authorized to administer the `AuthorizedCertificate` resource to manually map it to a DomainMapping resource. + Example: 12345. + +* `ssl_management_type` - + (Optional) + SSL management type for this domain. If `AUTOMATIC`, a managed certificate is automatically provisioned. + If `MANUAL`, `certificateId` must be manually specified in order to configure SSL for this domain. + +* `pending_managed_certificate_id` - + ID of the managed `AuthorizedCertificate` resource currently being provisioned, if applicable. Until the new + managed certificate has been successfully provisioned, the previous SSL state will be preserved. Once the + provisioning process completes, the `certificateId` field will reflect the new managed certificate and this + field will be left empty. To remove SSL support while there is still a pending managed certificate, clear the + `certificateId` field with an update request. + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are exported: + + +* `name` - + Full path to the DomainMapping resource in the API. Example: apps/myapp/domainMapping/example.com. + +* `resource_records` - + The resource records required to configure this domain mapping. These records must be added to the domain's DNS + configuration in order to serve the application via this domain mapping. Structure is documented below. + + +The `resource_records` block contains: + +* `name` - + (Optional) + Relative name of the object affected by this record. Only applicable for CNAME records. Example: 'www'. + +* `rrdata` - + (Optional) + Data for this record. Values vary by record type, as defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1). + +* `type` - + (Optional) + Resource record type. Example: `AAAA`. + +## Timeouts + +This resource provides the following +[Timeouts](/docs/configuration/resources.html#timeouts) configuration options: + +- `create` - Default is 4 minutes. +- `update` - Default is 4 minutes. +- `delete` - Default is 4 minutes. + +## Import + +DomainMapping can be imported using any of these accepted formats: + +``` +$ terraform import google_app_engine_domain_mapping.default {{domain_name}} +``` + +-> If you're importing a resource with beta features, make sure to include `-provider=google-beta` +as an argument so that Terraform uses the correct provider to import your resource. + +## User Project Overrides + +This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/provider_reference.html#user_project_override). diff --git a/website/google.erb b/website/google.erb index dc91ee8acfd..f593e7fa5d6 100644 --- a/website/google.erb +++ b/website/google.erb @@ -196,6 +196,9 @@ > google_app_engine_application + > + google_app_engine_domain_mapping + > google_app_engine_firewall_rule