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 date validator to data_source_storage_account_sas #4064

Merged

Conversation

lawrencegripper
Copy link
Contributor

@lawrencegripper lawrencegripper commented Aug 12, 2019

This PR adds an ISO8601 validator for use with the data_source_storage_account_sas data source.

There isn't currently a validator for the field so any string can be used and invalid sas token are generated (for example a "2000-06-31" but there is no 31st of 6th).

I use github.com/btubbs/datetime to parse the date.

I've added some tests and run the existing integration tests, all seems good :)

Why not use existing RFC3339 validator?

The ISO8601 standard is more relaxed than RFC3339 so it would fail on a number of valid inputs. For example ISO8601 allows 2000-01-01 without a time where as RGC3339 doesn't.

Issue reference

#4062

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @lawrencegripper

Thanks for this PR - apologies for the delayed review here!

Taking a look through this looks good, if we can fix up the log message this otherwise LGTM 👍

Thanks!

azurerm/helpers/validate/time_test.go Outdated Show resolved Hide resolved
@@ -6,6 +6,7 @@ import (
"time"

"github.com/Azure/go-autorest/autorest/date"
iso8601 "github.com/btubbs/datetime"
Copy link
Contributor

Choose a reason for hiding this comment

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

internal heads up: licence is MIT ✅

@tombuildsstuff tombuildsstuff added this to the v1.34.0 milestone Aug 21, 2019
Co-Authored-By: Tom Harvey <tombuildsstuff@users.noreply.github.com>
@lawrencegripper
Copy link
Contributor Author

@tombuildsstuff no problem, sorry for the slow fix my side. Log message updated. Ready to go! 👍

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for this @lawrencegripper

@tombuildsstuff tombuildsstuff merged commit 95095a9 into hashicorp:master Aug 27, 2019
tombuildsstuff added a commit that referenced this pull request Aug 27, 2019
@ghost
Copy link

ghost commented Sep 18, 2019

This has been released in version 1.34.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 1.34.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Sep 26, 2019

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 Sep 26, 2019
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.

2 participants