aztfmod / rover

The rover is a docker container in charge of the deployment of the Terraform platform engineering for Azure
MIT License
173 stars 144 forks source link

[bug] Add soveregin cloud endpoints and suffixes for modules (part 1) #155

Closed davesee closed 3 years ago

davesee commented 3 years ago

Describe the bug The MS SQL database db_permissions execution fails in non Azure Public clouds. This is because the URI suffix is hard coded into the module and is different for each cloud.

By passing the cloud information automatically down as a global setting, module authors are able to customize the behavior of their module for individual clouds when needed by using the proper variable instead of a string value.

The goal of this story is enhance sovereign cloud support by passing this value to CAF landing zones and modules as global settings. This allows modules and add-ons to conditionally load different configurations for different clouds.

The update consists of 3 repo updates:

  1. Rover retrieval of cloud variables and setting them to environment variables
  2. CAF_Solution landing zone creating a new variable namespace for each variable retrieved in step 1
  3. Module integration of cloud variables from step 2

To Reproduce Steps to reproduce the behavior:

  1. Login to a non Azure Public cloud
  2. Deploy CAF solution with mssql_database db_permissons
  3. Notice error:
    
    Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
    Error on or near line 286: Error running terraform apply; exiting with status 2001\


**Expected behavior**
The terraform deployment and db permission scripts should have the proper suffix and therefore connect and apply the permissions as required.

**Configuration (please complete the following information):**
 - Rover devcontainer latest
 - Landing zones latest
 - Azurerm modules latest

**Additional context**
Values can be retrieved by running 'az cloud show' in the respective cloud. This is run as part of rover and the values are extracted so they do not have to be set by the user.