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