From 41fa7aeb7457a3522ca20b5b4b9a86d3ad86488d Mon Sep 17 00:00:00 2001 From: Ed Fricker Date: Wed, 22 Sep 2021 12:43:32 +0100 Subject: [PATCH] Internal DNS records based on Rack status, not app status --- provider/aws/formation/app.json.tmpl | 8 +++++++- provider/aws/releases.go | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/provider/aws/formation/app.json.tmpl b/provider/aws/formation/app.json.tmpl index 6b53e5899c..e54d106202 100644 --- a/provider/aws/formation/app.json.tmpl +++ b/provider/aws/formation/app.json.tmpl @@ -17,6 +17,7 @@ "FargateTimersBase": { "Fn::Equals": [ { "Ref": "FargateTimers" }, "Yes" ] }, "FargateTimersSpot": { "Fn::Equals": [ { "Ref": "FargateTimers" }, "Spot" ] }, "InternalDomains": { "Fn::Equals": [ { "Ref": "InternalDomains" }, "Yes" ] }, + "InternalRack": { "Fn::Equals": [ { "Ref": "InternalRack" }, "Yes" ] }, "Isolate": { "Fn::And": [ { "Condition": "Private" }, { "Fn::Equals": [ { "Ref": "Isolate" }, "Yes" ] } ] }, "IsolateServices": { "Fn::Or": [ { "Condition": "FargateServicesEither" }, { "Condition": "Isolate" } ] }, "Private": { "Fn::Equals": [ { "Ref": "Private" }, "Yes" ] }, @@ -81,6 +82,11 @@ "Default": "Yes", "AllowedValues": [ "Yes", "No" ] }, + "InternalRack": { + "Type": "String", + "Default": "No", + "AllowedValues": [ "Yes", "No" ] + }, "Isolate": { "Type": "String", "Default": "No", @@ -197,7 +203,7 @@ "Name": { "Fn::Sub": "{{.Name}}.{{$.App}}.${Rack}.convox." }, "Type": "CNAME", "TTL": "3600", - "ResourceRecords": [ { "Fn::ImportValue": { "Fn::Sub": "${Rack}:Domain{{ if .Internal }}Internal{{ end }}" } } ] + "ResourceRecords": [ { "Fn::If": [ "InternalRack", { "Fn::ImportValue": { "Fn::Sub": "${Rack}:DomainInternal" } }, { "Fn::ImportValue": { "Fn::Sub": "${Rack}:Domain" } } ] } ] } }, {{ if not (certificate $.Certificates .Domains) }} diff --git a/provider/aws/releases.go b/provider/aws/releases.go index 7ebf27cd38..0c763429c7 100644 --- a/provider/aws/releases.go +++ b/provider/aws/releases.go @@ -347,12 +347,29 @@ func (p *Provider) ReleasePromote(app, id string, opts structs.ReleasePromoteOpt return err } + internal, err := p.stackParameter(p.Rack, "Internal") + if err != nil { + return err + } + + internalOnly, err := p.stackParameter(p.Rack, "InternalOnly") + if err != nil { + return err + } + + anyInternal := "No" + + if (internal == "Yes" || internalOnly == "Yes") { + anyInternal = "Yes" + } + private, err := p.stackParameter(p.Rack, "Private") if err != nil { return err } updates := map[string]string{ + "InternalRack": anyInternal, "LogBucket": p.LogBucket, "Private": private, }