-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
New Resource: azurerm_scheduler_job
#1172
Conversation
7a07134
to
634f9b4
Compare
634f9b4
to
beb79b8
Compare
travis CI fixes
d5c9817
to
2c9a46a
Compare
6b69b51
to
720eabc
Compare
azurerm_scheduler_job
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @katbyte
Apologies for the delayed review of this PR - I've taken a look through and left some comments in-line; but I've got questions both about the schema design (I think we should make this more Terraform-y) and how the tests are implemented (to make them easier to read)
Thanks!
azurerm/helpers/supress/suppress.go
Outdated
@@ -0,0 +1,23 @@ | |||
package supress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supress
-> suppress
azurerm/helpers/supress/suppress.go
Outdated
"time" | ||
|
||
"github.com/hashicorp/terraform/helper/schema" | ||
"strings" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor can we sort these?
Schema: map[string]*schema.Schema{ | ||
"day": { // DatOfWeek (sunday monday) | ||
Type: schema.TypeString, | ||
Required: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add some validation here?
|
||
for _, tc := range cases { | ||
if CaseDifference("test", tc.StringA, tc.StringB, nil) != tc.Suppress { | ||
t.Fatalf("Expected CaseDifference to return %t for '%s' == '%s'", tc.Suppress, tc.StringA, tc.StringB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor you can use %q
in place of '%s'
(or "%s"
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be using %q everywhere instead of %s?
azurerm/helpers/validate/validate.go
Outdated
url, err := url.Parse(v) | ||
if err != nil { | ||
errors = append(errors, fmt.Errorf("%q url is in an invalid format: %q (%+v)", k, i, err)) | ||
} else if url.Scheme != "http" && url.Scheme != "https" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a bit of an assumption given the name of the function - perhaps it's worth renaming this to WebUrl
?
method = "put" | ||
body = "this is some text" | ||
headers = { | ||
Content-Type = "text" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should quote this, since I think this could break in HCL2?
tenant_id = "%s" | ||
client_id = "%s" | ||
secret = "%s" | ||
audience = "https://management.core.windows.net/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we template this value? it's available on meta.(*ArmClient).environment..
resource.TestCheckResourceAttr(resourceName, "action_web.0.authentication_active_directory.0.tenant_id", tenantId), | ||
resource.TestCheckResourceAttr(resourceName, "action_web.0.authentication_active_directory.0.client_id", clientId), | ||
resource.TestCheckResourceAttr(resourceName, "action_web.0.authentication_active_directory.0.secret", secret), | ||
resource.TestCheckResourceAttr(resourceName, "action_web.0.authentication_active_directory.0.audience", "https://management.core.windows.net/"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can either use the full URI depending on the environment being used here or just ensure this is set?
body = "The job failed" | ||
|
||
headers = { | ||
Content-Type = "text" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(as above)
return hashcode.String(buf.String()) | ||
} | ||
|
||
//todo where to put these? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
azurerm/helpers/set/set.go
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from a few minor nits (which I'll push a commit for) this otherwise LGTM 👍
azurerm/helpers/validate/validate.go
Outdated
} | ||
|
||
for _, s := range validSchemes { | ||
if url.Scheme == s { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should be strings.EqualFold(url.Scheme, s)
to handle casing - but it's not a blocker
azurerm/helpers/validate/validate.go
Outdated
} | ||
} | ||
|
||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be adding a couldn't find it
error here?
@@ -0,0 +1 @@ | |||
package validate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add some basic tests covering the methods in the other file?
website/azurerm.erb
Outdated
@@ -736,6 +736,11 @@ | |||
<a href="/docs/providers/azurerm/r/scheduler_job_collection.html">azurerm_scheduler_job_collection</a> | |||
</li> | |||
</ul> | |||
<ul class="nav nav-visible"> | |||
<li<%= sidebar_current("docs-azurerm-resource-scheduler_job") %>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should suffix this to avoid highlight conflicts
Scheduler Job can be imported using a `resource id`, e.g. | ||
|
||
```shell | ||
terraform import azurerm_search_service.service1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Scheduler/jobCollections/jobCollection1/jobs/job1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
azurerm_search_service.service1
-> azurerm_scheduler_job.job1
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAzureRMSchedulerJob_web_basic(ri, testLocation()), | ||
Check: checkAccAzureRMSchedulerJob_web_basic(resourceName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should in-line these
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! |
No description provided.