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

fix env issue #1

Merged
merged 2 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ _ReSharper*/
# TeamCity is a build add-in
_TeamCity*

.vscode
# DotCover is a Code Coverage Tool
*.dotCover

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ It may take a few minutes to run the script. After successful running, you will

...
azurerm_role_assignment.servicebus_02_data_owner: Still creating...
azurerm_role_assignment.servicebus_03_data_owner: Still creating...
azurerm_role_assignment.servicebus_01_data_owner: Still creating...
azurerm_role_assignment.servicebus_01_data_owner: Creation complete after 29s...
azurerm_role_assignment.servicebus_03_data_owner: Creation complete after 29s...
azurerm_role_assignment.servicebus_02_data_owner: Creation complete after 29s...

Apply complete! Resources: 14 added, 0 changed, 0 destroyed.
Expand All @@ -92,9 +90,6 @@ Outputs:

AZURE_SERVICEBUS_NAMESPACE_01 = "${YOUR_SERVICEBUS_NAMESPACE_01}"
AZURE_SERVICEBUS_NAMESPACE_02 = "${YOUR_SERVICEBUS_NAMESPACE_02}"
AZURE_SERVICEBUS_NAMESPACE_03 = "${YOUR_SERVICEBUS_NAMESPACE_03}"


```

You can go to [Azure portal](https://ms.portal.azure.com/) in your web browser to check the resources you created.
Expand All @@ -103,7 +98,7 @@ You can go to [Azure portal](https://ms.portal.azure.com/) in your web browser t
Running the command below to export environment values:

```shell
source ./terraform/environment_values.sh
source ./terraform/setup_env.sh
```

## Run locally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ servicebus.producers[1]:
servicebus.processors[0]:
entity-name: queue1
entity-type: queue
namespace: ${AZURE_SERVICEBUS_NAMESPACE_03}
namespace: ${AZURE_SERVICEBUS_NAMESPACE_01}

#reduce some noise
logging.level:
com.azure.core: warn
com.azure.identity: warn
com.azure.messaging: warn
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ resource "azurecaf_name" "servicebus_01" {
clean_input = true
}

resource "null_resource" "null" {
provisioner "local-exec" {
command = "touch environment_values.sh && rm environment_values.sh"
}
}


resource "azurerm_servicebus_namespace" "servicebus_namespace_01" {
name = azurecaf_name.servicebus_01.result
Expand All @@ -61,14 +57,6 @@ resource "azurerm_servicebus_namespace" "servicebus_namespace_01" {

sku = "Standard"
zone_redundant = false

provisioner "local-exec" {
command = <<EOT
echo 'export AZURE_SERVICEBUS_NAMESPACE_01=${azurerm_servicebus_namespace.servicebus_namespace_01.name}' >> environment_values.sh
echo 'export AZURE_SERVICEBUS_NAMESPACE_03=${azurerm_servicebus_namespace.servicebus_namespace_01.name}' >> environment_values.sh
EOT

}
}

resource "azurerm_servicebus_queue" "application_queue_01" {
Expand Down Expand Up @@ -100,9 +88,7 @@ resource "azurerm_servicebus_namespace" "servicebus_namespace_02" {
sku = "Standard"
zone_redundant = false

provisioner "local-exec" {
command = "echo 'export AZURE_SERVICEBUS_NAMESPACE_02=${azurerm_servicebus_namespace.servicebus_namespace_02.name}' >> environment_values.sh"
}

}

resource "azurerm_servicebus_queue" "application_queue_02" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,4 @@ output "AZURE_SERVICEBUS_NAMESPACE_02" {
description = "The servicebus_02 namespace."
}

output "AZURE_SERVICEBUS_NAMESPACE_03" {
value = azurerm_servicebus_namespace.servicebus_namespace_01.name
description = "The servicebus_03 namespace."
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export AZURE_SERVICEBUS_NAMESPACE_01=$(terraform -chdir=./terraform output -raw AZURE_SERVICEBUS_NAMESPACE_01)
export AZURE_SERVICEBUS_NAMESPACE_02=$(terraform -chdir=./terraform output -raw AZURE_SERVICEBUS_NAMESPACE_02)