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 table azure_automation_variable closes #570 #571

Merged
merged 9 commits into from
Feb 22, 2023
Merged

Add table azure_automation_variable closes #570 #571

merged 9 commits into from
Feb 22, 2023

Conversation

ParthaI
Copy link
Contributor

@ParthaI ParthaI commented Feb 21, 2023

Integration test logs

Logs
No env file present for the current environment:  staging 
 Falling back to .env config
No env file present for the current environment:  staging
customEnv TURBOT_TEST_EXPECTED_TIMEOUT undefined

SETUP: tests/azure_automation_variable []

PRETEST: tests/azure_automation_variable

TEST: tests/azure_automation_variable
Running terraform
data.azurerm_client_config.current: Reading...
data.azurerm_client_config.current: Read complete after 0s [id=Y2xpZW50Q29uZmlncy9jbGllbnRJZD0wNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDY7b2JqZWN0SWQ9MDZmZDQ2YjAtYTg2Ny00OWExLWE0ZjEtZjc3Njg0NjVjYWJhO3N1YnNjcmlwdGlvbklkPWQ0NmQ3NDE2LWY5NWYtNDc3MS1iYmI1LTUyOWQ0Yzc2NjU5Yzt0ZW5hbnRJZD1jZGZmZDcwOC03ZGEwLTRjZWEtYWJlYi0wYTRjMzM0ZDdmNjQ=]
data.null_data_source.resource: Reading...
data.null_data_source.resource: Read complete after 0s [id=static]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_automation_account.named_test_resource will be created
  + resource "azurerm_automation_account" "named_test_resource" {
      + dsc_primary_access_key        = (sensitive value)
      + dsc_secondary_access_key      = (sensitive value)
      + dsc_server_endpoint           = (known after apply)
      + hybrid_service_url            = (known after apply)
      + id                            = (known after apply)
      + local_authentication_enabled  = true
      + location                      = "eastus"
      + name                          = "turbottest51689"
      + private_endpoint_connection   = (known after apply)
      + public_network_access_enabled = true
      + resource_group_name           = "turbottest51689"
      + sku_name                      = "Basic"
      + tags                          = {
          + "name" = "turbottest51689"
        }

      + encryption {
          + key_source                = (known after apply)
          + key_vault_key_id          = (known after apply)
          + user_assigned_identity_id = (known after apply)
        }
    }

  # azurerm_automation_variable_string.named_test_resource will be created
  + resource "azurerm_automation_variable_string" "named_test_resource" {
      + automation_account_name = "turbottest51689"
      + encrypted               = false
      + id                      = (known after apply)
      + name                    = "turbottest51689"
      + resource_group_name     = "turbottest51689"
      + value                   = "Hello, Terraform Basic Test."
    }

  # azurerm_resource_group.named_test_resource will be created
  + resource "azurerm_resource_group" "named_test_resource" {
      + id       = (known after apply)
      + location = "eastus"
      + name     = "turbottest51689"
    }

Plan: 3 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + resource_aka       = (known after apply)
  + resource_aka_lower = (known after apply)
  + resource_id        = (known after apply)
  + resource_name      = "turbottest51689"
  + subscription_id    = "j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs"
azurerm_resource_group.named_test_resource: Creating...
azurerm_resource_group.named_test_resource: Creation complete after 7s [id=/subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourceGroups/turbottest51689]
azurerm_automation_account.named_test_resource: Creating...
azurerm_automation_account.named_test_resource: Still creating... [10s elapsed]
azurerm_automation_account.named_test_resource: Creation complete after 12s [id=/subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourceGroups/turbottest51689/providers/Microsoft.Automation/automationAccounts/turbottest51689]
azurerm_automation_variable_string.named_test_resource: Creating...
azurerm_automation_variable_string.named_test_resource: Creation complete after 6s [id=/subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourceGroups/turbottest51689/providers/Microsoft.Automation/automationAccounts/turbottest51689/variables/turbottest51689]

Warning: Deprecated

  with data.null_data_source.resource,
  on variables.tf line 29, in data "null_data_source" "resource":
  29: data "null_data_source" "resource" {

The null_data_source was historically used to construct intermediate values
to re-use elsewhere in configuration, the same can now be achieved using
locals

(and one more similar warning elsewhere)

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

Outputs:

resource_aka = "azure:///subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourceGroups/turbottest51689/providers/Microsoft.Automation/automationAccounts/turbottest51689/variables/turbottest51689"
resource_aka_lower = "azure:///subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourcegroups/turbottest51689/providers/microsoft.automation/automationaccounts/turbottest51689/variables/turbottest51689"
resource_id = "/subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourceGroups/turbottest51689/providers/Microsoft.Automation/automationAccounts/turbottest51689/variables/turbottest51689"
resource_name = "turbottest51689"
subscription_id = "j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs"

Running SQL query: test-get-query.sql
[
  {
    "id": "/subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourceGroups/turbottest51689/providers/Microsoft.Automation/automationAccounts/turbottest51689/variables/turbottest51689",
    "name": "turbottest51689",
    "resource_group": "turbottest51689",
    "subscription_id": "j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs",
    "type": "Microsoft.Automation/AutomationAccounts/Variables"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "id": "/subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourceGroups/turbottest51689/providers/Microsoft.Automation/automationAccounts/turbottest51689/variables/turbottest51689",
    "name": "turbottest51689",
    "type": "Microsoft.Automation/AutomationAccounts/Variables"
  }
]
✔ PASSED

Running SQL query: test-not-found-query.sql
null
✔ PASSED

Running SQL query: test-turbot-query.sql
[
  {
    "akas": [
      "azure:///subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourceGroups/turbottest51689/providers/Microsoft.Automation/automationAccounts/turbottest51689/variables/turbottest51689",
      "azure:///subscriptions/j3847jrjf3-f95f-4771-bbb5-j3847jrjf3fdsljs/resourcegroups/turbottest51689/providers/microsoft.automation/automationaccounts/turbottest51689/variables/turbottest51689"
    ],
    "name": "turbottest51689",
    "title": "turbottest51689"
  }
]
✔ PASSED

POSTTEST: tests/azure_automation_variable

TEARDOWN: tests/azure_automation_variable

SUMMARY:

1/1 passed.


Example query results

Results
> select * from azure_automation_variable
+--------+-------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+---------------------------+----------------------
| name   | account_name            | id                                                                                                                                                                      | description | creation_time             | last_modified_time   
+--------+-------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+---------------------------+----------------------
| test23 | test-automation-account | /subscriptions/j3847jrjf3-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbot_rg/providers/Microsoft.Automation/automationAccounts/test-automation-account/variables/test23 | testing     | 2023-02-17T12:38:24+05:30 | 2023-02-17T12:38:24+0
+--------+-------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+---------------------------+----------------------

@ParthaI ParthaI self-assigned this Feb 21, 2023
@ParthaI ParthaI linked an issue Feb 21, 2023 that may be closed by this pull request
Copy link
Contributor

@misraved misraved left a comment

Choose a reason for hiding this comment

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

@ParthaI please take a look at the review comments. Thanks!!!

Name: "azure_automation_variable",
Description: "Azure Automation Variable",
Get: &plugin.GetConfig{
KeyColumns: plugin.AllColumns([]string{"name", "resource_group", "account_name"}),
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
KeyColumns: plugin.AllColumns([]string{"name", "resource_group", "account_name"}),
KeyColumns: plugin.AllColumns([]string{"account_name", "name", "resource_group" }),

},
{
Name: "id",
Description: "Fully qualified resource Id for the resource.",
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
Description: "Fully qualified resource Id for the resource.",
Description: "Fully qualified resource ID.",

automation.Variable
}

//// FETCH FUNCTIONS ////
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
//// FETCH FUNCTIONS ////
//// HYDRATE FUNCTIONS ////

Comment on lines 190 to 191
// In some cases resource does not give any notFound error
// instead of notFound error, it returns empty data
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
// In some cases resource does not give any notFound error
// instead of notFound error, it returns empty data
// In some cases the API does not return any notFound error
// instead it returns empty data

@@ -0,0 +1,52 @@
# Table: azure_automation_variable

Variable assets are values that are available to all runbooks and DSC configurations in your Automation account. You can manage them from the Azure portal, from PowerShell, within a runbook, or in a DSC configuration.
Copy link
Contributor

Choose a reason for hiding this comment

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

@ParthaI could you also add an example wherein the GET hydrate call is being invoked?

@misraved
Copy link
Contributor

misraved commented Feb 22, 2023

@ParthaI could you please add the missing logging information?

@misraved misraved merged commit 623c5a5 into main Feb 22, 2023
@misraved misraved deleted the issue-570 branch February 22, 2023 15:52
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.

Add table azure_automation_variable
2 participants