Skip to content

Commit

Permalink
Fix: aws/azure Terraform provider are broken (#2517)
Browse files Browse the repository at this point in the history
Removed built-in aws/azure Terraform providers, and fix azure
mariadb definition issue.

Fix #2475
  • Loading branch information
zzxwill committed Oct 19, 2021
1 parent eb5808e commit 516156f
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 24 deletions.
53 changes: 46 additions & 7 deletions charts/vela-core/templates/addons/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,13 @@ data:
}
resource "azurerm_resource_group" "example" {
name = "tfex-mariadb-database-RG"
location = "West Europe"
name = var.resource_group
location = var.location
}
resource "azurerm_mariadb_server" "example" {
name = "mariadb-svr-sample"
location = azurerm_resource_group.example.location
name = var.server_name
location = var.location
resource_group_name = azurerm_resource_group.example.name
sku_name = "B_Gen5_2"
Expand All @@ -397,15 +397,21 @@ data:
}
resource "azurerm_mariadb_database" "example" {
name = var.name
name = var.db_name
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_mariadb_server.example.name
charset = "utf8"
collation = "utf8_general_ci"
}
variable "name" {
default = "mariadb_database"
variable "server_name" {
type = string
description = "mariadb server name"
default = "mariadb-svr-sample"
}
variable "db_name" {
default = "backend"
type = string
description = "Database instance name"
}
Expand All @@ -421,6 +427,39 @@ data:
type = string
description = "Database instance password"
}
variable "location" {
description = "Azure location"
type = string
default = "West Europe"
}
variable "resource_group" {
description = "Resource group"
type = string
default = "kubevela-group"
}
output "SERVER_NAME" {
value = var.server_name
}
output "DB_NAME" {
value = var.db_name
}
output "DB_USER" {
value = var.username
}
output "DB_PASSWORD" {
sensitive = true
value = var.password
}
output "DB_PORT" {
value = "3306"
}
output "DB_HOST" {
value = azurerm_mariadb_server.example.fqdn
}
providerRef:
name: azure
namespace: default
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
github.com/mitchellh/hashstructure/v2 v2.0.1
github.com/oam-dev/cluster-gateway v1.1.2
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28
github.com/oam-dev/terraform-controller v0.2.1
github.com/oam-dev/terraform-controller v0.2.4
github.com/olekukonko/tablewriter v0.0.5
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.16.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,8 @@ github.com/oam-dev/stern v1.13.0-alpha h1:EVjM8Qvh6LssB6t4RZrjf9DtCq1cz+/cy6OF7f
github.com/oam-dev/stern v1.13.0-alpha/go.mod h1:AOkvfFUv0Arz7GBi0jz7S0Jsu4K/kdvSjNsnRt1+BIg=
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28 h1:tD8HiFKnt0jnwdTWjeqUnfnUYLD/+Nsmj8ZGIxqDWiU=
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28/go.mod h1:Mu8i0/DdplvnjwRbAYPsc8+LRR27n/mp8VWdkN10GzE=
github.com/oam-dev/terraform-controller v0.2.1 h1:gGXcUDBMWKfWet84STm99RX6gXo89pyTRsgQSLq2mog=
github.com/oam-dev/terraform-controller v0.2.1/go.mod h1:5Vy6jLx9fjotEd6E005Ve1f0x3fEpVlG/DVjmqLjAq0=
github.com/oam-dev/terraform-controller v0.2.4 h1:yGgIzm2EWNghuRutnChrRfhMjdlU/jE/cLfBizCgE24=
github.com/oam-dev/terraform-controller v0.2.4/go.mod h1:wd4rnqnJzz274Sg1/qoeIhBx1rvTZ/ECzXoMff0ucR0=
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
Expand Down
53 changes: 46 additions & 7 deletions vela-templates/addons/auto-gen/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,13 @@ spec:
}
resource "azurerm_resource_group" "example" {
name = "tfex-mariadb-database-RG"
location = "West Europe"
name = var.resource_group
location = var.location
}
resource "azurerm_mariadb_server" "example" {
name = "mariadb-svr-sample"
location = azurerm_resource_group.example.location
name = var.server_name
location = var.location
resource_group_name = azurerm_resource_group.example.name
sku_name = "B_Gen5_2"
Expand All @@ -394,15 +394,21 @@ spec:
}
resource "azurerm_mariadb_database" "example" {
name = var.name
name = var.db_name
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_mariadb_server.example.name
charset = "utf8"
collation = "utf8_general_ci"
}
variable "name" {
default = "mariadb_database"
variable "server_name" {
type = string
description = "mariadb server name"
default = "mariadb-svr-sample"
}
variable "db_name" {
default = "backend"
type = string
description = "Database instance name"
}
Expand All @@ -418,6 +424,39 @@ spec:
type = string
description = "Database instance password"
}
variable "location" {
description = "Azure location"
type = string
default = "West Europe"
}
variable "resource_group" {
description = "Resource group"
type = string
default = "kubevela-group"
}
output "SERVER_NAME" {
value = var.server_name
}
output "DB_NAME" {
value = var.db_name
}
output "DB_USER" {
value = var.username
}
output "DB_PASSWORD" {
sensitive = true
value = var.password
}
output "DB_PORT" {
value = "3306"
}
output "DB_HOST" {
value = azurerm_mariadb_server.example.fqdn
}
providerRef:
name: azure
namespace: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ spec:
}
resource "azurerm_resource_group" "example" {
name = "tfex-mariadb-database-RG"
location = "West Europe"
name = var.resource_group
location = var.location
}
resource "azurerm_mariadb_server" "example" {
name = "mariadb-svr-sample"
location = azurerm_resource_group.example.location
name = var.server_name
location = var.location
resource_group_name = azurerm_resource_group.example.name
sku_name = "B_Gen5_2"
Expand All @@ -44,15 +44,21 @@ spec:
}
resource "azurerm_mariadb_database" "example" {
name = var.name
name = var.db_name
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_mariadb_server.example.name
charset = "utf8"
collation = "utf8_general_ci"
}
variable "name" {
default = "mariadb_database"
variable "server_name" {
type = string
description = "mariadb server name"
default = "mariadb-svr-sample"
}
variable "db_name" {
default = "backend"
type = string
description = "Database instance name"
}
Expand All @@ -68,6 +74,41 @@ spec:
type = string
description = "Database instance password"
}
variable "location" {
description = "Azure location"
type = string
default = "West Europe"
}
variable "resource_group" {
description = "Resource group"
type = string
default = "kubevela-group"
}
output "SERVER_NAME" {
value = var.server_name
}
output "DB_NAME" {
value = var.db_name
}
output "DB_USER" {
value = var.username
}
output "DB_PASSWORD" {
sensitive = true
value = var.password
}
output "DB_PORT" {
value = "3306"
}
output "DB_HOST" {
value = azurerm_mariadb_server.example.fqdn
}
providerRef:
name: azure
namespace: default

0 comments on commit 516156f

Please sign in to comment.