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

Conversion from BICEP to Terraform - Part 1 #508

Merged
merged 40 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
fb2d095
initial commit terraform
ryonsteele Dec 29, 2023
da2d326
Update app service variables and continuing transformations
ryonsteele Jan 2, 2024
6c13678
Update one app service to linux_web_app
ryonsteele Jan 3, 2024
bcdc3b0
Add azure roles file
ryonsteele Jan 22, 2024
17efc01
Updates to branch
ryonsteele Jan 23, 2024
b68a14e
Add cors to storage
ryonsteele Jan 23, 2024
f76df80
Resolve configuration for enrichmentweb and search
ryonsteele Jan 24, 2024
c0073a6
Begin Entra object migration
ryonsteele Jan 26, 2024
b63fc36
Migrate entra object creation
ryonsteele Jan 29, 2024
93ba2b7
Upgrade deprecated resources
ryonsteele Jan 30, 2024
bc59857
files
ryonsteele Feb 1, 2024
89ecfce
Add Terraform and TFLint to Dockerfile
dayland-ms Feb 1, 2024
9df222e
Add sourcing of prepare-tf-variables.sh script
dayland-ms Feb 2, 2024
27be5af
Update runtime stack for updated function resource
ryonsteele Feb 2, 2024
1d5ca33
Autoscale settings
ryonsteele Feb 5, 2024
b9f0c36
Keyvault implementation
ryonsteele Feb 5, 2024
2f9fa9e
Parse tf output for debug files
ryonsteele Feb 6, 2024
85b1ebb
Some oryx changes
ryonsteele Feb 6, 2024
006e9f1
Application config flattening
ryonsteele Feb 8, 2024
a017fd0
useExistingAOAI configurations implementations
ryonsteele Feb 12, 2024
85578fe
Bump aoai api version
ryonsteele Feb 13, 2024
6ead2ed
Log Workbook addition
ryonsteele Feb 13, 2024
a817f9d
try adding aoai rg to tmp env
ryonsteele Feb 19, 2024
8f93db6
Add isAutomation to entra module
ryonsteele Feb 19, 2024
1b639e2
Add isAutomation to entra module
ryonsteele Feb 19, 2024
69aa6ba
Add isAutomation to entra module
ryonsteele Feb 19, 2024
7c0f98c
Add isAutomation to entra module
ryonsteele Feb 19, 2024
2b4116f
Fix path for fun tests script
ryonsteele Feb 19, 2024
3b7fbf3
Fix script perm
ryonsteele Feb 19, 2024
922ff6a
Fix script perm
ryonsteele Feb 19, 2024
c0bbf9f
Fix inf-destroy rg variable
ryonsteele Feb 20, 2024
0a22b57
fix entra module tuple, kv purge protection
ryonsteele Feb 20, 2024
e7c197b
flatten TF folders into infra and scripts
dayland-ms Feb 23, 2024
def7b20
Update Azure AD variables and outputs
dayland-ms Feb 23, 2024
b39db41
Update enrichmentapp.tf and main.tf
dayland-ms Feb 26, 2024
e1ec6bd
Add video indexer module and update management service principal role…
dayland-ms Feb 26, 2024
f4a908b
Remove demo-blue.env and demo-red.env, update shared-ia-dev.env, shar…
dayland-ms Feb 26, 2024
29871dd
Enable Azure OpenAI Embeddings in shared-ia-dev and shared-ia environ…
dayland-ms Feb 26, 2024
aeadd84
Update enrichmentapp.tf and main.tf
dayland-ms Feb 27, 2024
f7daac0
whitespace change to trigger new PR build
dayland-ms Feb 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ RUN /tmp/docker-client.sh $USERNAME
RUN git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1 \
&& echo "if [ -f \"$HOME/.bash-git-prompt/gitprompt.sh\" ]; then GIT_PROMPT_ONLY_IN_REPO=1 && source $HOME/.bash-git-prompt/gitprompt.sh; fi" >> "/home/$USERNAME/.bashrc"

# terraform + tflint
ARG TERRAFORM_VERSION=1.3.7
ARG TFLINT_VERSION=0.44.1
RUN mkdir -p /tmp/docker-downloads \
&& curl -sSL -o /tmp/docker-downloads/terraform.zip https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip \
&& unzip /tmp/docker-downloads/terraform.zip \
&& mv terraform /usr/local/bin \
&& rm /tmp/docker-downloads/terraform.zip \
&& echo "alias tf=terraform" >> "/home/$USERNAME/.bashrc"

RUN curl -sSL -o /tmp/docker-downloads/tflint.zip https://github.com/wata727/tflint/releases/download/v${TFLINT_VERSION}/tflint_linux_amd64.zip \
&& unzip /tmp/docker-downloads/tflint.zip \
&& mv tflint /usr/local/bin \
&& rm /tmp/docker-downloads/tflint.zip

# azure-cli
COPY ./scripts/azure-cli.sh /tmp/
RUN /tmp/azure-cli.sh
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"ms-azuretools.vscode-azureresourcegroups",
"ms-azuretools.vscode-azurefunctions",
"ms-python.python",
"ms-python.pylint"
"ms-python.pylint",
"HashiCorp.terraform"
],

"remoteUser": "vscode"
Expand Down
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ main.parameters.json
infrastructure.env
infrastructure.debug.env
infra_output.json
inf_output.json
random.txt
.state

Expand All @@ -385,4 +386,12 @@ app/backend/shared_code
packages-microsoft*

# docker container build artifacts
app/enrichment/shared_code
app/enrichment/shared_code

#terraform
.terraform
infra/.terraform*
terraform.tfstate
terraform.tfstate.d
.tfplan.txt
infra/infoasst*
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ infrastructure: check-subscription ## Deploy infrastructure
@./scripts/inf-create.sh

extract-env: extract-env-debug-webapp extract-env-debug-functions ## Extract infrastructure.env file from BICEP output
@./scripts/json-to-env.sh < infra_output.json > ./scripts/environments/infrastructure.env
@./scripts/json-to-env.sh < inf_output.json > ./scripts/environments/infrastructure.env

deploy-webapp: extract-env ## Deploys the web app code to Azure App Service
@./scripts/deploy-webapp.sh
Expand All @@ -40,10 +40,10 @@ deploy-search-indexes: extract-env ## Deploy search indexes
@./scripts/deploy-search-indexes.sh

extract-env-debug-webapp: ## Extract infrastructure.debug.env file from BICEP output
@./scripts/json-to-env.webapp.debug.sh < infra_output.json > ./scripts/environments/infrastructure.debug.env
@./scripts/json-to-env.webapp.debug.sh < inf_output.json > ./scripts/environments/infrastructure.debug.env

extract-env-debug-functions: ## Extract local.settings.json to debug functions from BICEP output
@./scripts/json-to-env.function.debug.sh < infra_output.json > ./functions/local.settings.json
@./scripts/json-to-env.function.debug.sh < inf_output.json > ./functions/local.settings.json

# Utils (used by other Makefile rules)
check-subscription:
Expand All @@ -57,4 +57,4 @@ destroy-inf: check-subscription
@./scripts/inf-destroy.sh

functional-tests: extract-env ## Run functional tests to check the processing pipeline is working
@./scripts/functional-tests.sh
@./scripts/functional-tests.sh
7 changes: 4 additions & 3 deletions app/backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"AZURE_SEARCH_INDEX": "gptkbindex",
"AZURE_OPENAI_SERVICE": "myopenai",
"AZURE_OPENAI_RESOURCE_GROUP": "",
"AZURE_OPENAI_ENDPOINT": "",
"AZURE_OPENAI_CHATGPT_DEPLOYMENT": "gpt-35-turbo-16k",
"AZURE_OPENAI_CHATGPT_MODEL_NAME": "",
"AZURE_OPENAI_CHATGPT_MODEL_VERSION": "",
Expand Down Expand Up @@ -95,8 +96,8 @@

# Used by the OpenAI SDK
openai.api_type = "azure"
openai.api_base = "https://" + ENV["AZURE_OPENAI_SERVICE"] + ".openai.azure.com/"
openai.api_version = "2023-06-01-preview"
openai.api_base = ENV["AZURE_OPENAI_ENDPOINT"]
openai.api_version = "2023-12-01-preview"

# Setup StatusLog to allow access to CosmosDB for logging
statusLog = StatusLog(
Expand Down Expand Up @@ -166,7 +167,7 @@
chat_approaches = {
Approaches.ReadRetrieveRead: ChatReadRetrieveReadApproach(
search_client,
ENV["AZURE_OPENAI_SERVICE"],
ENV["AZURE_OPENAI_ENDPOINT"],
ENV["AZURE_OPENAI_SERVICE_KEY"],
ENV["AZURE_OPENAI_CHATGPT_DEPLOYMENT"],
ENV["KB_FIELDS_SOURCEFILE"],
Expand Down
5 changes: 3 additions & 2 deletions app/backend/approaches/chatreadretrieveread.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ChatReadRetrieveReadApproach(Approach):
def __init__(
self,
search_client: SearchClient,
oai_service_name: str,
oai_endpoint: str,
oai_service_key: str,
chatgpt_deployment: str,
source_file_field: str,
Expand Down Expand Up @@ -118,13 +118,14 @@ def __init__(
self.target_translation_language=target_translation_language
self.enrichment_endpoint=enrichment_endpoint
self.enrichment_key=enrichment_key
self.oai_endpoint=oai_endpoint

if is_gov_cloud_deployment:
self.embedding_service_url = f'https://{enrichment_appservice_name}.azurewebsites.us'
else:
self.embedding_service_url = f'https://{enrichment_appservice_name}.azurewebsites.net'

openai.api_base = 'https://' + oai_service_name + '.openai.azure.com/'
openai.api_base = oai_endpoint
openai.api_type = 'azure'
openai.api_key = oai_service_key

Expand Down
2 changes: 1 addition & 1 deletion app/enrichment/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
openai.api_base = "https://" + ENV["AZURE_OPENAI_SERVICE"] + ".openai.azure.com/"
openai.api_type = "azure"
openai.api_key = ENV["AZURE_OPENAI_SERVICE_KEY"]
openai.api_version = "2023-06-01-preview"
openai.api_version = "2023-12-01-preview"

class AzOAIEmbedding(object):
"""A wrapper for a Azure OpenAI Embedding model"""
Expand Down
5 changes: 2 additions & 3 deletions infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ If you have chosen to enable authentication and authorization for your deploymen
Once deployed, you can find the URL of your installation by:

1) Browse to your new Resource Group at https://portal.azure.com and locate the "App Service"
![Location of App Service in Portal](../docs/images/deployment_app_service_location.jpg)
![Location of App Service in Portal](./docs/images/deployment_app_service_location.jpg)

2) After clicking on the App Service, you will see the "Default domain" listed. This is the link to your installation.
![Default Domain of App Service in Portal](../docs/images/deployment_default_domain.jpg)
![Default Domain of App Service in Portal](./docs/images/deployment_default_domain.jpg)


## Next steps

At this point deployment is complete. Please go to the [Using the IA Accelerator for the first time](../README.md#using-ia-accelerator-for-the-first-time) section and complete the following steps.

146 changes: 0 additions & 146 deletions infra/abbreviations.json

This file was deleted.

68 changes: 68 additions & 0 deletions infra/arm_templates/video_indexer/avi.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"$schema": "${arm_template_schema_mgmt_api}/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string",
"metadata" : {
"description" : "The name of the AVAM resource"
},
"defaultValue": "avam-account"
},
"managedIdentityId": {
"type": "string",
"metadata" : {
"description" : "The managed identity used to grant access to the Azure Storage account"
},
"defaultValue": ""
},
"storageServicesResourceId": {
"type": "string",
"metadata" : {
"description" : "The Storage Account Id for storing uploaded videos. The Account needs to be created prior to the creation of this template"
},
"defaultValue" : ""
},
"tags": {
"type": "object",
"metadata" : {
"description" : "Arm Template Tags"
},
"defaultValue": {}
},
"apiVersion": {
"type": "string",
"metadata": {
"description": "Video indexer api version"
}
}
},
"resources": [
{
"type": "Microsoft.VideoIndexer/accounts",
"apiVersion": "[parameters('apiVersion')]",
"name": "[parameters('name')]",

"location": "[resourceGroup().location]",
"tags": "[parameters('tags')]",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"[parameters('managedIdentityId')]": {}
}
},
"properties": {
"storageServices": {
"resourceId": "[parameters('storageServicesResourceId')]",
"userAssignedIdentity": "[parameters('managedIdentityId')]"
}
}
}
],
"outputs": {
"avam_id": {
"value": "[reference(resourceId('Microsoft.VideoIndexer/accounts',parameters('name'))).accountId]",
"type": "string"
}
}
}
Loading
Loading