github.com/erriapo/terraform@v0.6.12-0.20160203182612-0340ea72354f/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  ```
    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  ```
    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      # etc, etc; see aws_db_instance docs for more
    49  }
    50  
    51  # Configure the MySQL provider based on the outcome of
    52  # creating the aws_db_instance.
    53  provider "mysql" {
    54      endpoint = "${aws_db_instance.default.endpoint}"
    55      username = "${aws_db_instance.default.username}"
    56      password = "${aws_db_instance.default.password}"
    57  }
    58  
    59  # Create a second database, in addition to the "initial_db" created
    60  # by the aws_db_instance resource above.
    61  resource "mysql_database" "app" {
    62      name = "another_db"
    63  }
    64  ```
    65  
    66  ## Argument Reference
    67  
    68  The following arguments are supported:
    69  
    70  * `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.
    71  * `username` - (Required) Username to use to authenticate with the server.
    72  * `password` - (Optional) Password for the given user, if that user has a password.