Skip to content

Commit

Permalink
Made DNS_ZONE_RESOURCE_GROUP_NAME optional, defaults to ACI_RESOURCE_…
Browse files Browse the repository at this point in the history
…GROUP_NAME
  • Loading branch information
tmeckel committed Dec 12, 2021
1 parent 0f6f148 commit e28b27f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ The program is configured via various environment variables
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------- |
| `ARM_SUBSCRIPTION_ID` | The Azure subscription of the ACI | yes |
| `ACI_RESOURCE_GROUP_NAME` | The resource group in which the ACI is deployed | yes |
| `DNS_ZONE_RESOURCE_GROUP_NAME` | The resource group of the private DNS Zone | yes |
| `DNS_ZONE_NAME` | The name of the DNS zone in which the A record shall be created | yes |
| `DNS_ZONE_NAME` | The name of the DNS zone in which the A record shall be created | yes |
| `AZURE_TENANT_ID` | The id (guid) of the Azure Tenant in which the service principal is located used for authentication | no, required if: AZURE_CLIENT_ID is specified |
| `AZURE_CLIENT_ID` | The id (guid) of the service principal used for authentication | no |
| `AZURE_CLIENT_SECRET` | The secret (password) of the service principal used for authentication | no, required if: AZURE_CLIENT_ID is specified |
| `ACI_INSTANCE_NAME` | The name of the ACI for which a a DNS A record shall be created. <br /> If not specified the environment variable `Fabric_CodePackageName` will be used. <br /> However, it was found that the ACI runtime does not reliably set this variable. So to prevent any errors the `ACI_INSTANCE_NAME` variable should always be set | no, if `Fabric_CodePackageName` is used |
| `ACI_MAX_RETRY` | Number of retries to get deployment information (IP address) of the configured ACI | no, default: `10` |
| `ACI_TIMEOUT` | How long to wait between retries | no, default: `10` seconds |
| `DNS_ZONE_RESOURCE_GROUP_NAME` | The resource group of the private DNS Zone | no, default: `ACI_RESOURCE_GROUP_NAME` |
| `DNS_ZONE_RESOURCE_SUBSCRIPTION_ID` | If the private DNS zone is located in a different subscription than the ACI instance, this variable contains the Id (guid) of this subscription. | no, default `ARM_SUBSCRIPTION_ID` |
| `DNS_A_RECORD_NAME` | The name of the DNS A record to create. | no, default `container name` |
| `DNS_A_RECORD_TTL` | The TTL value of the DNS A record | no, default `3600` |
Expand Down
6 changes: 5 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ func main() {
if dnsZoneSubscriptionID == "" {
dnsZoneSubscriptionID = os.Getenv("ARM_SUBSCRIPTION_ID")
}
dnsRecordsClient, err := internal.NewPrivateDNSRecordSetsClient(auth, dnsZoneSubscriptionID, os.Getenv("DNS_ZONE_RESOURCE_GROUP_NAME"), os.Getenv("DNS_ZONE_NAME"))
dnsZoneResourceGroup := os.Getenv("DNS_ZONE_RESOURCE_GROUP_NAME")
if dnsZoneResourceGroup == "" {
dnsZoneResourceGroup = os.Getenv("ACI_RESOURCE_GROUP_NAME")
}
dnsRecordsClient, err := internal.NewPrivateDNSRecordSetsClient(auth, dnsZoneSubscriptionID, dnsZoneResourceGroup, os.Getenv("DNS_ZONE_NAME"))
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to create private DNS record set client: %+v\n", err)
os.Exit(1)
Expand Down

0 comments on commit e28b27f

Please sign in to comment.