ansible-collections / cloud.terraform

The collection automates the management and provisioning of infrastructure as code (IaC) using the Terraform CLI tool within Ansible playbooks and Execution Environment runtimes.
GNU General Public License v3.0
100 stars 36 forks source link

Inventory terraform_state - add azurerm vm types #119

Closed akira6592 closed 8 months ago

akira6592 commented 8 months ago
SUMMARY

Add azurerm vm types azurerm_linux_virtual_machine and azurerm_windows_virtual_machine.

ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION

The official Terraform documentation states the following:

The azurerm_virtual_machine resource has been superseded by the azurerm_linux_virtual_machine and azurerm_windows_virtual_machine resources.

My environment test.

$ ansible-inventory -i terraform_state.yml --graph --vars
@all:
  |--@ungrouped:
  |  |--azurerm_linux_virtual_machine_vm-linux    # provisioned by resource azurerm_linux_virtual_machine
  ...
  |  |  |--{source_image_reference = [{'offer': 'UbuntuServer', 'publisher': 'Canonical', 'sku': '16.04-LTS', 'version': 'latest'}]}
  ...
  |  |--azurerm_windows_virtual_machine_vm-win  # provisioned by resource azurerm_windows_virtual_machine_vm
  ...
  |  |  |--{source_image_reference = [{'offer': 'WindowsServer', 'publisher': 'MicrosoftWindowsServer', 'sku': '2022-datacenter-azure-edition', 'version': 'latest'}]}
softwarefactory-project-zuul[bot] commented 8 months ago

Build succeeded. https://ansible.softwarefactory-project.io/zuul/buildset/999c79572558477f93d9e7d822f67e76

:heavy_check_mark: ansible-galaxy-importer SUCCESS in 4m 56s :heavy_check_mark: build-ansible-collection SUCCESS in 8m 08s

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.49%. Comparing base (8c52bf2) to head (9ef69f0). Report is 9 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #119 +/- ## ========================================== + Coverage 73.00% 79.49% +6.49% ========================================== Files 16 23 +7 Lines 1015 1434 +419 Branches 182 252 +70 ========================================== + Hits 741 1140 +399 - Misses 243 252 +9 - Partials 31 42 +11 ``` | [Flag](https://app.codecov.io/gh/ansible-collections/cloud.terraform/pull/119/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ansible-collections) | Coverage Ξ” | | |---|---|---| | [sanity](https://app.codecov.io/gh/ansible-collections/cloud.terraform/pull/119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ansible-collections) | `?` | | | [units](https://app.codecov.io/gh/ansible-collections/cloud.terraform/pull/119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ansible-collections) | `79.49% <ΓΈ> (+6.88%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ansible-collections#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

akira6592 commented 8 months ago

Thank you for merging.

patchback[bot] commented 6 months ago

Backport to stable-2: πŸ’” cherry-picking failed β€” conflicts found

❌ Failed to cleanly apply 95786c976e6ed59d07ed922606cee3b38ef69581 on top of patchback/backports/stable-2/95786c976e6ed59d07ed922606cee3b38ef69581/pr-119

Backporting merged PR #119 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these instructions you'll refer to it by the name upstream. If you don't have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible-collections/cloud.terraform.git
  3. Ensure you have the latest copy of upstream and prepare a branch that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-2/95786c976e6ed59d07ed922606cee3b38ef69581/pr-119 upstream/stable-2
  4. Now, cherry-pick PR #119 contents into that branch:
    $ git cherry-pick -x 95786c976e6ed59d07ed922606cee3b38ef69581

    If it'll yell at you with something like fatal: Commit 95786c976e6ed59d07ed922606cee3b38ef69581 is a merge but no -m option was given., add -m 1 as follows instead:

    $ git cherry-pick -m1 -x 95786c976e6ed59d07ed922606cee3b38ef69581
  5. At this point, you'll probably encounter some merge conflicts. You must resolve them in to preserve the patch from PR #119 as close to the original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-2/95786c976e6ed59d07ed922606cee3b38ef69581/pr-119
  7. Create a PR, ensure that the CI is green. If it's not β€” update it so that the tests and any other checks pass. This is it! Now relax and wait for the maintainers to process your pull request when they have some cycles to do reviews. Don't worry β€” they'll tell you if any improvements are necessary when the time comes!

πŸ€– @patchback I'm built with octomachinery and my source is open β€” https://github.com/sanitizers/patchback-github-app.