Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backup_configuration for mssql database type #143

Merged
merged 3 commits into from
Sep 14, 2020
Merged

backup_configuration for mssql database type #143

merged 3 commits into from
Sep 14, 2020

Conversation

odise
Copy link
Contributor

@odise odise commented Sep 11, 2020

This adds backup configuration settings to MSSQL module. Reference #128 .

Copy link
Contributor

@morgante morgante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please get tests passing too:

       Error: "settings.0.backup_configuration.0.enabled": one of `settings.0.backup_configuration.0.binary_log_enabled,settings.0.backup_configuration.0.enabled,settings.0.backup_configuration.0.location,settings.0.backup_configuration.0.point_in_time_recovery_enabled,settings.0.backup_configuration.0.start_time` must be specified
       
         on ../../../modules/mssql/main.tf line 40, in resource "google_sql_database_instance" "default":
         40: resource "google_sql_database_instance" "default" {

@@ -51,6 +51,15 @@ resource "google_sql_database_instance" "default" {
activation_policy = var.activation_policy
availability_type = var.availability_type
authorized_gae_applications = var.authorized_gae_applications
dynamic "backup_configuration" {
for_each = [var.backup_configuration]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for_each = [var.backup_configuration]
for_each = var.backup_configuration.enabled ? [var.backup_configuration] : []

Copy link
Contributor Author

@odise odise Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@morgante I pushed the changes that you requested and the test mssql-ha-local locally runs fine. Could you please tell me why it is failing here?

-----> Verifying <mssql-ha-local>...
$$$$$$ Running command `terraform workspace select kitchen-terraform-mssql-ha-local` in directory /workspace/test/fixtures/mssql-ha
$$$$$$ Running command `terraform output -json` in directory /workspace/test/fixtures/mssql-ha
system: Verifying

Profile: Google Cloud SQL (cloud-sql)
Version: 0.1.0
Target:  gcp://terraform-serviceaccount@xxx.iam.gserviceaccount.com

  Database tf-mssql-ha-0ff8be4032
     ✔  should include {:activation_policy => "ALWAYS", :availability_type => "REGIONAL", :data_disk_size_gb => 10, :data_disk_type => "PD_SSD", :kind => "sql#settings", :pricing_plan => "PER_USE", :replication_type => "SYNCHRONOUS", :storage_auto_resize => true, :storage_auto_resize_limit => 0, :tier => "db-custom-2-13312"}
     ✔  should include {:authorized_networks => [{:kind => "sql#aclEntry", :name => "xxx-cidr", :value => "192.10.10.10/32"}], :ipv4_enabled => true, :require_ssl => true}
     ✔  should include {:kind => "sql#locationPreference", :zone => "us-central1-a"}
     ✔  should include {:kind => "sql#maintenanceWindow", :day => 7, :hour => 12, :update_track => "stable"}
     ✔  should include {:foo => "bar"}
     ✔  backend_type should eq "SECOND_GEN"
     ✔  database_version should eq "SQLSERVER_2017_STANDARD"
     ✔  state should eq "RUNNABLE"
     ✔  region should eq "us-central1"
     ✔  gce_zone should eq "us-central1-a"
  google_sql_users with user_name == /\Atftest/
     ✔  should exist
     ✔  count should equal 3

Profile: Google Cloud Platform Resource Pack (inspec-gcp)
Version: 0.21.4
Target:  gcp://terraform-serviceaccount@xxx.iam.gserviceaccount.com

     No tests executed.

Test Summary: 12 successful, 0 failures, 0 skipped
       Finished verifying <mssql-ha-local> (0m55.60s).
-----> Kitchen is finished. (0m59.00s)

Copy link
Contributor

@morgante morgante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error looks unrelated.

@morgante morgante merged commit bed1cb4 into terraform-google-modules:master Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants