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

Add Backup Support to azurerm_redis_cache #130

Merged
merged 15 commits into from
Jun 28, 2017
Merged

Conversation

tombuildsstuff
Copy link
Contributor

Adds support for the backup fields:

  • rdb-backup-enabled
  • rdb-backup-frequency
  • rdb-backup-max-snapshot-count
  • rdb-storage-connection-string

Fixes #75

@tombuildsstuff
Copy link
Contributor Author

Tests pass:

$ TF_ACC=1 envchain azurerm go test ./azurerm -v -timeout 300m -parallel 5 -run TestAccAzureRMRedisCache_
=== RUN   TestAccAzureRMRedisCache_basic
--- PASS: TestAccAzureRMRedisCache_basic (636.27s)
=== RUN   TestAccAzureRMRedisCache_standard
--- PASS: TestAccAzureRMRedisCache_standard (747.48s)
=== RUN   TestAccAzureRMRedisCache_premium
--- PASS: TestAccAzureRMRedisCache_premium (627.24s)
=== RUN   TestAccAzureRMRedisCache_premiumSharded
--- PASS: TestAccAzureRMRedisCache_premiumSharded (1356.70s)
=== RUN   TestAccAzureRMRedisCache_NonStandardCasing
--- PASS: TestAccAzureRMRedisCache_NonStandardCasing (682.86s)
=== RUN   TestAccAzureRMRedisCache_BackupDisabled
--- PASS: TestAccAzureRMRedisCache_BackupDisabled (685.17s)
=== RUN   TestAccAzureRMRedisCache_BackupEnabled
--- PASS: TestAccAzureRMRedisCache_BackupEnabled (893.95s)
PASS

@tombuildsstuff
Copy link
Contributor Author

Removed the State Migration and added a test enabling, then disabling the backup:

$ TF_ACC=1 envchain azurerm go test ./azurerm -v -timeout 300m -parallel 5 -run TestAccAzureRMRedisCache_Backup

=== RUN   TestAccAzureRMRedisCache_BackupDisabled
--- PASS: TestAccAzureRMRedisCache_BackupDisabled (650.91s)
=== RUN   TestAccAzureRMRedisCache_BackupEnabled
--- PASS: TestAccAzureRMRedisCache_BackupEnabled (645.86s)
=== RUN   TestAccAzureRMRedisCache_BackupEnabledDisabled
--- PASS: TestAccAzureRMRedisCache_BackupEnabledDisabled (694.48s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1991.281s

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

I'm not overly happy about the types. I don't know what's considered conventional in MSFT/Azure world nor I have checked if this is what we do in other Azure resources, nonetheless I think it's defeating the purpose of having typed schema (and taking advantage of basic HCL/HIL validation).

Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
ValidateFunc: validation.StringInSlice([]string{
Copy link
Member

@radeksimko radeksimko Jun 27, 2017

Choose a reason for hiding this comment

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

Is there any particular reason we want to have string here? Stringifyed boolean values don't look nice and break the whole point of having a (semi)typed schema IMO.

Even if the reason here is API/SDK then I think we should solve that problem and do our bit internally in the CRUD and/or DiffSuppressFunc/StateFunc so that the user doesn't have to deal with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was originally due to the API design - but by chatting in Slack we've managed to work around this 👍

}, true),
},
"rdb_backup_frequency": {
Type: schema.TypeString,
Copy link
Member

Choose a reason for hiding this comment

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

Similar question here - any reason we cannot make it TypeInt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

ValidateFunc: validateRedisBackupFrequency,
},
"rdb_backup_max_snapshot_count": {
Type: schema.TypeString,
Copy link
Member

Choose a reason for hiding this comment

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

☝️ TypeInt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@tombuildsstuff tombuildsstuff force-pushed the redis-backup-settings branch from d2f6626 to 61aed53 Compare June 28, 2017 10:28
@tombuildsstuff
Copy link
Contributor Author

Tests pass:
screen shot 2017-06-28 at 14 20 33

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

As mentioned via Slack this LGTM, as long as you can verify we don't need a state migration due to changes in the existing schema.

@tombuildsstuff
Copy link
Contributor Author

I've confirmed there's no state migration needed by creating a Redis instance using a build from master, ensuring an empty plan - and then rebuilding with this branch + re-planning / updating values - LGTM 👍

@tombuildsstuff tombuildsstuff merged commit ab6ced3 into master Jun 28, 2017
@tombuildsstuff tombuildsstuff deleted the redis-backup-settings branch June 28, 2017 15:11
tombuildsstuff added a commit that referenced this pull request Jun 28, 2017
tombuildsstuff added a commit that referenced this pull request Jul 4, 2017
Add Backup Support to `azurerm_redis_cache`
tombuildsstuff added a commit that referenced this pull request Jul 4, 2017
@ghost
Copy link

ghost commented Apr 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support backup settings for Premium azurerm_redis_cache
2 participants