-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vishal Anarse <vishal@civo.com>
- Loading branch information
Vishal Anarse
committed
Jul 24, 2023
1 parent
dd9c51e
commit 69c0e67
Showing
7 changed files
with
91 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 23 additions & 23 deletions
46
examples/data-sources/civo_database_version/data-source.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
# Example for mysql | ||
data civo_database_version "mysql" { | ||
data "civo_database_version" "mysql" { | ||
filter { | ||
key = "engine" | ||
values = ["mysql"] | ||
} | ||
key = "engine" | ||
values = ["mysql"] | ||
} | ||
} | ||
|
||
# Example for postgresql | ||
data civo_database_version "postgresql" { | ||
data "civo_database_version" "postgresql" { | ||
filter { | ||
key = "engine" | ||
values = ["postgresql"] | ||
} | ||
key = "engine" | ||
values = ["postgresql"] | ||
} | ||
} | ||
|
||
data "civo_size" "small" { | ||
filter { | ||
key = "name" | ||
values = ["db.small"] | ||
match_by = "re" | ||
} | ||
filter { | ||
key = "type" | ||
values = ["database"] | ||
} | ||
filter { | ||
key = "name" | ||
values = ["db.small"] | ||
match_by = "re" | ||
} | ||
filter { | ||
key = "type" | ||
values = ["database"] | ||
} | ||
} | ||
|
||
# To use this data source, make sure you have a database cluster created. | ||
resource "civo_database" "custom_database" { | ||
name = "custom_database" | ||
size = element(data.civo_size.small.sizes, 0).name | ||
nodes = 2 | ||
engine = element(data.civo_database_version.mysql.versions, 0).engine | ||
version = element(data.civo_database_version.mysql.versions, 0).version | ||
} | ||
name = "custom_database" | ||
size = element(data.civo_size.small.sizes, 0).name | ||
nodes = 2 | ||
engine = element(data.civo_database_version.mysql.versions, 0).engine | ||
version = element(data.civo_database_version.mysql.versions, 0).version | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
data "civo_size" "small" { | ||
filter { | ||
key = "name" | ||
values = ["db.small"] | ||
match_by = "re" | ||
} | ||
filter { | ||
key = "type" | ||
values = ["database"] | ||
} | ||
filter { | ||
key = "name" | ||
values = ["db.small"] | ||
match_by = "re" | ||
} | ||
filter { | ||
key = "type" | ||
values = ["database"] | ||
} | ||
} | ||
|
||
data civo_database_version "mysql" { | ||
data "civo_database_version" "mysql" { | ||
filter { | ||
key = "engine" | ||
values = ["mysql"] | ||
} | ||
key = "engine" | ||
values = ["mysql"] | ||
} | ||
} | ||
|
||
resource "civo_database" "custom_database" { | ||
name = "custom_database" | ||
size = element(data.civo_size.small.sizes, 0).name | ||
nodes = 2 | ||
engine = element(data.civo_database_version.mysql.versions, 0).engine | ||
version = element(data.civo_database_version.mysql.versions, 0).version | ||
} | ||
name = "custom_database" | ||
size = element(data.civo_size.small.sizes, 0).name | ||
nodes = 2 | ||
engine = element(data.civo_database_version.mysql.versions, 0).engine | ||
version = element(data.civo_database_version.mysql.versions, 0).version | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters