-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 resource azurerm_automation_job_schedule #3386
Add resource azurerm_automation_job_schedule #3386
Conversation
- removed start_time as a parameter
- changed name/nameUUID to jobScheduleID and JobScheduleUUID - Fix some errors referring to Automation Schedule instead of Automation Job Schedule
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.
Thanks for the new resource @draggeta,
I've left some comments inline but this is off to a good start, once we have the tests sorted and some additional validation this should be good to merge.
I needed to use rand to generate the random string as there were issues with the datetime random string. If the tests were run separately, there would be no issues, but if you run them in parallel, they would generate the same random string and conflict. |
There is also an issue where the parameters for the runbook have different capitalization randomly. This happens in the API. I've tested it with my own runbooks without terraform and it happens there as well. Sometimes a parameter named "Output" in my script, displays as "output" in the API while other times a parameter named "ResourceGroup" appears as "ResourceGroup" in the API. Is it an idea to make everything lower case when comparing/writing to state or should it be left as is? |
Is that a random occurrence that happens on the API side? If that is the case they what we should do is open a bug on the azure-sdk-for-go detailing what the issue is, link to it here. Thinks like resource group names shouldn't change case randomly. Once the issue is opened we can mark the property as case insensitive in the schema with a comment linking to the azure-sdk-for-go issue. |
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.
Thanks for the updates,
the tests are failing for us currently:
------- Stdout: -------
=== RUN TestAccAzureRMAutomationJobSchedule_basic
=== PAUSE TestAccAzureRMAutomationJobSchedule_basic
=== CONT TestAccAzureRMAutomationJobSchedule_basic
--- FAIL: TestAccAzureRMAutomationJobSchedule_basic (105.87s)
testing.go:568: Step 0 error: errors during apply:
Error: Error creating/updating Automation Runbook "Output-HelloWorld" (Account "acctestAA-5577006791947779410" / Resource Group "acctestRG-5577006791947779410"): automation.RunbookClient#CreateOrUpdate: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="NotFound" Message="{\"Message\":\"Could not find the account. SubscriptionId: XXXXXXX AccountName: acctestAA-5577006791947779410\"}"
on /opt/teamcity-agent/temp/buildTmp/tf-test668228083/main.tf line 18:
(source code not available)
FAIL
and
------- Stdout: -------
=== RUN TestAccAzureRMAutomationJobSchedule_complete
=== PAUSE TestAccAzureRMAutomationJobSchedule_complete
=== CONT TestAccAzureRMAutomationJobSchedule_complete
--- FAIL: TestAccAzureRMAutomationJobSchedule_complete (107.69s)
testing.go:568: Step 0 error: Check failed: 1 error occurred:
* Check 1/8 error: Automation Job Schedule '32f72eef-b997-4d32-a890-123b9f6c5a72' (Account "acctestAA-5577006791947779410" / Resource Group "acctestRG-5577006791947779410") does not exist
FAIL
Hi @katbyte , I've just run the tests and they run successfully here. I don't know why they failed on your end. --- FAIL: TestAccAzureRMAutomationJobSchedule_complete (77.17s)
testing.go:568: Step 0 error: errors during apply:
Error: automation.JobScheduleClient#Create: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="A job schedule for the specified runbook and schedule already exists."
on ~\AppData\Local\Temp\tf-test676055953\main.tf line 49:
(source code not available) It could be a Windows issue where it somehow grabs the same 4 random numbers every time. For now I'll change it so hopefully it succeeds on your end. |
@katbyte there seems to be a bug in the runbook deployment. In don't know exactly what, but it seems like it's not creating and/or updating the resources. Reading works fine. This doesn't only happen in my branch, but also with v 1.35 of the AzureRM module. I'll try and look into it tomorrow. |
Sounds good @draggeta, thank you for the update! |
After some further testing it seems that only the createorupdate function is broken. Reading, listing, and deleting all work fine. I'll go and test it with the SDK directly |
Hi @katbyte, After too many hours spent trying to figure out what wasn't working I figured out it was the script itself in the publish link parameter: The above link now returns a 404. Is it possible to put a script somewhere in this repo or somewhere else that won't change? The script also must remain static as one of the tests verifies the hash. It needs to be changed for for the runbook tests as well. |
You should be able to use the commit/tag it was last available in. However long term it would be ideal to add a short one of our own to this repo so in the future we can link to it once merged to master (but not required to get this merged) |
@katbyte Should be done now. I don't know why I didn't think of that. |
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.
Thanks for fixing this @draggeta! LGTM 👍
This has been released in version 1.36.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.36.0"
}
# ... other configuration ... |
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 👉 [email protected]. Thanks! |
For a personal project I was looking for this resource and while there are issues requesting this, there were no PRs. This PR adds the job schedule as a resource.
Closes #1955
Remarks
This resource only supports create, delete and import. No updates are possible. Any change recreates the resource.
I'm also not sure what to do about the requiresImport test, so if it is wrong, please let me know.
Example
Exports
The following items are also exported
Acceptance tests