github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/website/source/docs/providers/google/r/sql_database_instance.html.markdown (about)

     1  ---
     2  layout: "google"
     3  page_title: "Google: google_sql_database_instance"
     4  sidebar_current: "docs-google-sql-database-instance"
     5  description: |-
     6    Creates a new SQL database instance in Google Cloud SQL.
     7  ---
     8  
     9  # google\_sql\_database\_instance
    10  
    11  Creates a new Google SQL Database Instance. For more information, see the [official documentation](https://cloud.google.com/sql/), or the [JSON API](https://cloud.google.com/sql/docs/admin-api/v1beta4/instances).
    12  
    13  ## Example Usage
    14  
    15  Example creating a SQL Database.
    16  
    17  ```js
    18  resource "google_sql_database_instance" "master" {
    19    name = "master-instance"
    20  
    21    settings {
    22      tier = "D0"
    23    }
    24  }
    25  ```
    26  
    27  ## Argument Reference
    28  
    29  The following arguments are supported:
    30  
    31  * `region` - (Required) The region the instance will sit in. Note, this does
    32      not line up with the Google Compute Engine (GCE) regions - your options are
    33      `us-central`, `asia-west1`, `europe-west1`, and `us-east1`.
    34  
    35  * `settings` - (Required) The settings to use for the database. The
    36      configuration is detailed below.
    37  
    38  - - -
    39  
    40  * `database_version` - (Optional, Default: `MYSQL_5_6`) The MySQL version to
    41      use. Can be either `MYSQL_5_6` or `MYSQL_5_7` for second-generation
    42      instances, or `MYSQL_5_5` or `MYSQL_5_6` for first-generation instances.
    43      See Google's [Second Generation Capabilities](https://cloud.google.com/sql/docs/1st-2nd-gen-differences)
    44      for more information.
    45  
    46  * `name` - (Optional, Computed) The name of the instance. If the name is left
    47      blank, Terraform will randomly generate one when the instance is first
    48      created. This is done because after a name is used, it cannot be reused for
    49      up to [two months](https://cloud.google.com/sql/docs/delete-instance).
    50  
    51  * `master_instance_name` - (Optional) The name of the instance that will act as
    52      the master in the replication setup. Note, this requires the master to have
    53      `binary_log_enabled` set, as well as existing backups.
    54  
    55  * `project` - (Optional) The project in which the resource belongs. If it
    56      is not provided, the provider project is used.
    57  
    58  * `replica_configuration` - (Optional) The configuration for replication. The
    59      configuration is detailed below.
    60  
    61  The required `settings` block supports:
    62  
    63  * `tier` - (Required) The machine tier to use. See
    64      [pricing](https://cloud.google.com/sql/pricing) for more details and
    65      supported versions.
    66  
    67  * `activation_policy` - (Optional) This specifies when the instance should be
    68      active. Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`.
    69  
    70  * `authorized_gae_applications` - (Optional) A list of Google App Engine (GAE)
    71      project names that are allowed to access this instance.
    72  
    73  * `crash_safe_replication` - (Optional) Specific to read instances, indicates
    74      when crash-safe replication flags are enabled.
    75  
    76  * `pricing_plan` - (Optional) Pricing plan for this instance, can be one of
    77      `PER_USE` or `PACKAGE`.
    78  
    79  * `replication_type` - (Optional) Replication type for this instance, can be one
    80      of `ASYNCHRONOUS` or `SYNCHRONOUS`.
    81  
    82  The optional `settings.database_flags` sublist supports:
    83  
    84  * `name` - (Optional) Name of the flag.
    85  
    86  * `value` - (Optional) Value of the flag.
    87  
    88  The optional `settings.backup_configuration` subblock supports:
    89  
    90  * `binary_log_enabled` - (Optional) True iff binary logging is enabled. If
    91      `logging` is false, this must be as well.
    92  
    93  * `enabled` - (Optional) True iff backup configuration is enabled.
    94  
    95  * `start_time` - (Optional) `HH:MM` format time indicating when backup
    96      configuration starts.
    97  
    98  The optional `settings.ip_configuration` subblock supports:
    99  
   100  * `ipv4_enabled` - (Optional) True iff the instance should be assigned an IP
   101      address.
   102  
   103  * `require_ssl` - (Optional) True iff mysqld should default to `REQUIRE X509`
   104      for users connecting over IP.
   105  
   106  The optional `settings.ip_configuration.authorized_networks[]` sublist supports:
   107  
   108  * `expiration_time` - (Optional) The [RFC 3339](https://tools.ietf.org/html/rfc3339)
   109    formatted date time string indicating when this whitelist expires.
   110  
   111  * `name` - (Optional) A name for this whitelist entry.
   112  
   113  * `value` - (Optional) A CIDR notation IPv4 or IPv6 address that is allowed to
   114      access this instance. Must be set even if other two attributes are not for
   115      the whitelist to become active.
   116  
   117  The optional `settings.location_preference` subblock supports:
   118  
   119  * `follow_gae_application` - (Optional) A GAE application whose zone to remain
   120      in. Must be in the same region as this instance.
   121  
   122  * `zone` - (Optional) The preferred compute engine
   123      [zone](https://cloud.google.com/compute/docs/zones?hl=en).
   124  
   125  The optional `replica_configuration` block must have `master_instance_name` set
   126  to work, cannot be updated, and supports:
   127  
   128  * `ca_certificate` - (Optional) PEM representation of the trusted CA's x509
   129      certificate.
   130  
   131  * `client_certificate` - (Optional) PEM representation of the slave's x509
   132      certificate.
   133  
   134  * `client_key` - (Optional) PEM representation of the slave's private key. The
   135      corresponding public key in encoded in the `client_certificate`.
   136  
   137  * `connect_retry_interval` - (Optional, Default: 60) The number of seconds
   138      between connect retries.
   139  
   140  * `dump_file_path` - (Optional) Path to a SQL file in GCS from which slave
   141      instances are created. Format is `gs://bucket/filename`.
   142  
   143  * `master_heartbeat_period` - (Optional) Time in ms between replication
   144      heartbeats.
   145  
   146  * `password` - (Optional) Password for the replication connection.
   147  
   148  * `sslCipher` - (Optional) Permissible ciphers for use in SSL encryption.
   149  
   150  * `username` - (Optional) Username for replication connection.
   151  
   152  * `verify_server_certificate` - (Optional) True iff the master's common name
   153      value is checked during the SSL handshake.
   154  
   155  ## Attributes Reference
   156  
   157  In addition to the arguments listed above, the following computed attributes are
   158  exported:
   159  
   160  * `ip_address.ip_address` - The IPv4 address assigned.
   161  
   162  * `ip_address.time_to_retire` - The time this IP address will be retired, in RFC
   163      3339 format.
   164  
   165  * `self_link` - The URI of the created resource.
   166  
   167  * `settings.version` - Used to make sure changes to the `settings` block are
   168      atomic.