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

AzureRM Terraform Backend #2

Merged
merged 3 commits into from
Feb 20, 2024
Merged

Conversation

abikouo
Copy link
Contributor

@abikouo abikouo commented Jan 11, 2024

azurerm_backend A role to create/delete the necessary Azure infrastructure for an Azurerm remote backend for Terraform.

@abikouo abikouo force-pushed the azure_rm_backend branch 3 times, most recently from 44daa54 to be583dd Compare January 15, 2024 14:19
README.md Outdated Show resolved Hide resolved
@abikouo abikouo force-pushed the azure_rm_backend branch 2 times, most recently from 64cc7a6 to 9adcd56 Compare January 22, 2024 08:59
@abikouo abikouo changed the base branch from main to stable-azurerm January 22, 2024 09:01
@abikouo abikouo closed this Jan 22, 2024
@abikouo abikouo reopened this Jan 22, 2024
@abikouo abikouo closed this Jan 22, 2024
@abikouo abikouo reopened this Jan 22, 2024
@abikouo abikouo force-pushed the azure_rm_backend branch 3 times, most recently from 2b6bd05 to 75b7dcb Compare January 22, 2024 13:48
@abikouo abikouo changed the base branch from stable-azurerm to main January 22, 2024 14:06
.github/workflows/integration.yml Outdated Show resolved Hide resolved
roles/azurerm_backend/README.md Outdated Show resolved Hide resolved
roles/azurerm_backend/README.md Outdated Show resolved Hide resolved
roles/azurerm_backend/meta/argument_specs.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@mandar242 mandar242 left a comment

Choose a reason for hiding this comment

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

other than few open review comments, lgtm!

Copy link
Contributor

@hakbailey hakbailey left a comment

Choose a reason for hiding this comment

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

I'm not able to get the role assigned to the service principal as expected. It works if I change the azure.azcollection.azure_rm_roleassignment module to add principal_type="ServicePrincipal" here, but without that I was getting an error: Error creating role assignment: (PrincipalNotFound).

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
roles/azurerm_backend/meta/argument_specs.yml Outdated Show resolved Hide resolved
roles/azurerm_backend/meta/argument_specs.yml Outdated Show resolved Hide resolved
roles/azurerm_backend/meta/argument_specs.yml Outdated Show resolved Hide resolved
roles/azurerm_backend/meta/argument_specs.yml Outdated Show resolved Hide resolved
@abikouo
Copy link
Contributor Author

abikouo commented Feb 19, 2024

I'm not able to get the role assigned to the service principal as expected. It works if I change the azure.azcollection.azure_rm_roleassignment module to add principal_type="ServicePrincipal" here, but without that I was getting an error: Error creating role assignment: (PrincipalNotFound).

@hakbailey I have made a minor update, it is working using the following playbook

- hosts: localhost
  gather_facts: false

  tasks:
    - name: List All
      azure_rm_roleassignment_info:
      register: az_role_assignments

    - set_fact:
        sp_list: "{{ az_role_assignments.roleassignments | selectattr('principal_type', 'equalto', 'ServicePrincipal') | list }}"
    
    - include_role:
        name: cloud.terraform_ops.azurerm_backend
      vars:
        azurerm_backend_operation: create
        azurerm_backend_resource_group_name: "{{ resource_group }}"
        azurerm_backend_location: "eastus"
        azurerm_backend_container_name: "terraform"
        azurerm_backend_service_principal_id: "{{ sp_list[0].principal_id }}"
      when: sp_list | length > 0

@abikouo abikouo requested a review from hakbailey February 19, 2024 15:56
@alinabuzachis
Copy link
Contributor

@abikouo Can you please rebase?

@abikouo abikouo merged commit b805b74 into redhat-cop:main Feb 20, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants