Skip to content

Commit

Permalink
[#3467] Internal DNS records based on Rack status, not app status
Browse files Browse the repository at this point in the history
null
  • Loading branch information
beastawakens committed Sep 23, 2021
1 parent e962bfa commit 1287aac
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
8 changes: 7 additions & 1 deletion provider/aws/formation/app.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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" ] },
Expand Down Expand Up @@ -81,6 +82,11 @@
"Default": "Yes",
"AllowedValues": [ "Yes", "No" ]
},
"InternalRack": {
"Type": "String",
"Default": "No",
"AllowedValues": [ "Yes", "No" ]
},
"Isolate": {
"Type": "String",
"Default": "No",
Expand Down Expand Up @@ -192,7 +198,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) }}
Expand Down
17 changes: 17 additions & 0 deletions provider/aws/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit 1287aac

Please sign in to comment.