github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/mysql/index.html.markdown (about)

     1  ---
     2  layout: "mysql"
     3  page_title: "Provider: MySQL"
     4  sidebar_current: "docs-mysql-index"
     5  description: |-
     6    A provider for MySQL Server.
     7  ---
     8  
     9  # MySQL Provider
    10  
    11  [MySQL](http://www.mysql.com) is a relational database server. The MySQL
    12  provider exposes resources used to manage the configuration of resources
    13  in a MySQL server.
    14  
    15  Use the navigation to the left to read about the available resources.
    16  
    17  ## Example Usage
    18  
    19  The following is a minimal example:
    20  
    21  ```hcl
    22  # Configure the MySQL provider
    23  provider "mysql" {
    24    endpoint = "my-database.example.com:3306"
    25    username = "app-user"
    26    password = "app-password"
    27  }
    28  
    29  # Create a Database
    30  resource "mysql_database" "app" {
    31    name = "my_awesome_app"
    32  }
    33  ```
    34  
    35  This provider can be used in conjunction with other resources that create
    36  MySQL servers. For example, ``aws_db_instance`` is able to create MySQL
    37  servers in Amazon's RDS service.
    38  
    39  ```hcl
    40  # Create a database server
    41  resource "aws_db_instance" "default" {
    42    engine         = "mysql"
    43    engine_version = "5.6.17"
    44    instance_class = "db.t1.micro"
    45    name           = "initial_db"
    46    username       = "rootuser"
    47    password       = "rootpasswd"
    48  
    49    # etc, etc; see aws_db_instance docs for more
    50  }
    51  
    52  # Configure the MySQL provider based on the outcome of
    53  # creating the aws_db_instance.
    54  provider "mysql" {
    55    endpoint = "${aws_db_instance.default.endpoint}"
    56    username = "${aws_db_instance.default.username}"
    57    password = "${aws_db_instance.default.password}"
    58  }
    59  
    60  # Create a second database, in addition to the "initial_db" created
    61  # by the aws_db_instance resource above.
    62  resource "mysql_database" "app" {
    63    name = "another_db"
    64  }
    65  ```
    66  
    67  ## Argument Reference
    68  
    69  The following arguments are supported:
    70  
    71  * `endpoint` - (Required) The address of the MySQL server to use. Most often a "hostname:port" pair, but may also be an absolute path to a Unix socket when the host OS is Unix-compatible.
    72  * `username` - (Required) Username to use to authenticate with the server.
    73  * `password` - (Optional) Password for the given user, if that user has a password.