github.com/jrasell/terraform@v0.6.17-0.20160523115548-2652f5232949/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_5`) The MySQL version to 41 use. Can be either `MYSQL_5_5` or `MYSQL_5_6`. 42 43 * `name` - (Optional, Computed) The name of the instance. If the name is left 44 blank, Terraform will randomly generate one when the instance is first 45 created. This is done because after a name is used, it cannot be reused for 46 up to [two months](https://cloud.google.com/sql/docs/delete-instance). 47 48 * `master_instance_name` - (Optional) The name of the instance that will act as 49 the master in the replication setup. Note, this requires the master to have 50 `binary_log_enabled` set, as well as existing backups. 51 52 * `project` - (Optional) The project in which the resource belongs. If it 53 is not provided, the provider project is used. 54 55 * `replica_configuration` - (Optional) The configuration for replication. The 56 configuration is detailed below. 57 58 The required `settings` block supports: 59 60 * `tier` - (Required) The machine tier to use. See 61 [pricing](https://cloud.google.com/sql/pricing) for more details and 62 supported versions. 63 64 * `activation_policy` - (Optional) This specifies when the instance should be 65 active. Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. 66 67 * `authorized_gae_applications` - (Optional) A list of Google App Engine (GAE) 68 project names that are allowed to access this instance. 69 70 * `crash_safe_replication` - (Optional) Specific to read instances, indicates 71 when crash-safe replication flags are enabled. 72 73 * `pricing_plan` - (Optional) Pricing plan for this instance, can be one of 74 `PER_USE` or `PACKAGE`. 75 76 * `replication_type` - (Optional) Replication type for this instance, can be one 77 of `ASYNCHRONOUS` or `SYNCHRONOUS`. 78 79 The optional `settings.database_flags` sublist supports: 80 81 * `name` - (Optional) Name of the flag. 82 83 * `value` - (Optional) Value of the flag. 84 85 The optional `settings.backup_configuration` subblock supports: 86 87 * `binary_log_enabled` - (Optional) True iff binary logging is enabled. If 88 `logging` is false, this must be as well. 89 90 * `enabled` - (Optional) True iff backup configuration is enabled. 91 92 * `start_time` - (Optional) `HH:MM` format time indicating when backup 93 configuration starts. 94 95 The optional `settings.ip_configuration` subblock supports: 96 97 * `ipv4_enabled` - (Optional) True iff the instance should be assigned an IP 98 address. 99 100 * `require_ssl` - (Optional) True iff mysqld should default to `REQUIRE X509` 101 for users connecting over IP. 102 103 The optional `settings.ip_configuration.authorized_networks[]` sublist supports: 104 105 * `expiration_time` - (Optional) The [RFC 3339](https://tools.ietf.org/html/rfc3339) 106 formatted date time string indicating when this whitelist expires. 107 108 * `name` - (Optional) A name for this whitelist entry. 109 110 * `value` - (Optional) A CIDR notation IPv4 or IPv6 address that is allowed to 111 access this instance. Must be set even if other two attributes are not for 112 the whitelist to become active. 113 114 The optional `settings.location_preference` subblock supports: 115 116 * `follow_gae_application` - (Optional) A GAE application whose zone to remain 117 in. Must be in the same region as this instance. 118 119 * `zone` - (Optional) The preferred compute engine 120 [zone](https://cloud.google.com/compute/docs/zones?hl=en). 121 122 The optional `replica_configuration` block must have `master_instance_name` set 123 to work, cannot be updated, and supports: 124 125 * `ca_certificate` - (Optional) PEM representation of the trusted CA's x509 126 certificate. 127 128 * `client_certificate` - (Optional) PEM representation of the slave's x509 129 certificate. 130 131 * `client_key` - (Optional) PEM representation of the slave's private key. The 132 corresponding public key in encoded in the `client_certificate`. 133 134 * `connect_retry_interval` - (Optional, Default: 60) The number of seconds 135 between connect retries. 136 137 * `dump_file_path` - (Optional) Path to a SQL file in GCS from which slave 138 instances are created. Format is `gs://bucket/filename`. 139 140 * `master_heartbeat_period` - (Optional) Time in ms between replication 141 heartbeats. 142 143 * `password` - (Optional) Password for the replication connection. 144 145 * `sslCipher` - (Optional) Permissible ciphers for use in SSL encryption. 146 147 * `username` - (Optional) Username for replication connection. 148 149 * `verify_server_certificate` - (Optional) True iff the master's common name 150 value is checked during the SSL handshake. 151 152 ## Attributes Reference 153 154 In addition to the arguments listed above, the following computed attributes are 155 exported: 156 157 * `ip_address.ip_address` - The IPv4 address assigned. 158 159 * `ip_address.time_to_retire` - The time this IP address will be retired, in RFC 160 3339 format. 161 162 * `self_link` - The URI of the created resource. 163 164 * `settings.version` - Used to make sure changes to the `settings` block are 165 atomic.