最近更新时间:2019-12-12 16:53:30
Provides an SqlServer instance resource. A DB instance is an isolated database environment in the cloud. A DB instance can contain multiple user-created databases.
»Create a RDS SqlServer instance
provider "ksyun"{
region = "cn-shanghai-3"
access_key = ""
secret_key = ""
}
variable "available_zone" {
default = "cn-shanghai-3a"
}
resource "ksyun_vpc" "default" {
vpc_name = "ksyun-vpc-tf"
cidr_block = "10.7.0.0/21"
}
resource "ksyun_subnet" "foo" {
subnet_name = "ksyun-subnet-tf"
cidr_block = "10.7.0.0/21"
subnet_type = "Reserve"
dhcp_ip_from = "10.7.0.2"
dhcp_ip_to = "10.7.0.253"
vpc_id = "${ksyun_vpc.default.id}"
gateway_ip = "10.7.0.1"
dns1 = "198.18.254.41"
dns2 = "198.18.254.40"
availability_zone = "${var.available_zone}"
}
resource "ksyun_sqlserver" "sqlserver-1"{
output_file = "output_file"
dbinstanceclass= "db.ram.2|db.disk.20"
dbinstancename = "ksyun_sqlserver_1"
dbinstancetype = "HRDS_SS"
engine = "SQLServer"
engineversion = "2008r2"
masterusername = "admin"
masteruserpassword = "123qweASD"
vpc_id = "${ksyun_vpc.default.id}"
subnet_id = "${ksyun_subnet.foo.id}"
billtype = "DAY"
}
The following arguments are supported:
output_file
-(Required) will return the file name of the content storedb_instance_class
-(Required)-this value regex db.ram.d{1,3}|db.disk.d{1,5} , db.ram is rds random access memory size, db.disk is disk sizedb_instance_name
-(Required)instance namedb_instance_type
- (Required)instance type supports HRDS_SSengine (Required)
-engine is db type, only support SQLServerengine_version
- (Required)db engine version only support 2008r2,2012,2016master_user_name
- (Required)database primary account namemaster_user_password
-(Required) master account passwordvpc_id
- (Required)ID of virtual private networksubnet_id
- (Required)subnet IDbill_type
- (Required) Bill type, year’month (monthly package), day (daily billing), default: year’monthduration
- (Optional) purchase duration in monthssecurity_group_id
-(Optional) security group IDpreferred_backup_time
- (Optional) backup timeavailability_zone_1
- (Optional) zone 1availability_zone_2
- (Optional) zone 2project_id
- (Optional) subproject IDparameters
- (Optional) database parametersport
-(Optional) port numberIn addition to all arguments above, the following attributes are exported:
DBInstanceClass
- instance specificationVcpus
- number of CPUsDisk
- hard disk sizeRam
- memory sizeDBInstanceIdentifier
- instance IDDBInstanceName
- instance nameDBInstanceStatus
- instance statusDBInstanceType
- instance typeDBParameterGroupId
- parameter group IDGroupId
- group IDSecurityGroupId
- security group IDVip
- virtual IPPort
- port numberEngine
- Database EngineEngineVersion
- database engine versionInstanceCreateTime
- instance creation timeMasterUserName
- primary account user nameDatastoreVersionId
- database versionRegion
- regionVpcId
-virtual private network IDReadReplicaDBInstanceIdentifiers
- read only instanceBillType
- Bill typeMultiAvailabilityZone
- Multi availability zoneProductId
- Product IDDiskUsed
- hard disk usageProjectId
- Project IDNOTE: SQLServer not support modify
»Attributes Reference
The following attributes are exported:
id - The RDS instance ID.
port - RDS database connection port.
»Timeouts
NOTE: Available in 1.52.1+.
The timeouts block allows you to specify timeouts for certain actions:
create - (Defaults to 30 mins) Used when creating the db instance (until it reaches the initial Running status).
update - (Defaults to 30 mins) Used when updating the db instance (until it reaches the initial Running status).
delete - (Defaults to 10 mins) Used when terminating the db instance.
纯净模式