Skip to content

Commit

Permalink
Fix Fedora CoreOS AWS AMI query in non-US regions
Browse files Browse the repository at this point in the history
* A `aws_ami` data source will fail a Terraform plan
if no matching AMI is found, even if the AMI is not
used. ARM64 images are only published to a few US
regions, so the `aws_ami` data query could fail when
creating Fedora CoreOS AWS clusters in non-US regions
* Condition `aws_ami` on whether experimental arch
`arm64` is chosen
* Recent regression introduced in v1.19.4
#875

Closes #886
  • Loading branch information
dghubble committed Nov 25, 2020
1 parent ba8d972 commit fa8f68f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ Notable changes between versions.
* NLB DNS name has both A and AAAA records
* NLB to target node traffic is IPv4 (no change)

### Fedora CoreOS

#### AWS

* Fix AMI query for which could fail in some regions ([#887](https://github.com/poseidon/typhoon/pull/887))

### Addons

* Update Prometheus from v2.22.2 to [v2.23.0-rc.0](https://github.com/prometheus/prometheus/releases/tag/v2.23.0-rc.0)
Expand Down
2 changes: 2 additions & 0 deletions aws/fedora-coreos/kubernetes/ami.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ data "aws_ami" "fedora-coreos" {
# WARNING: These AMIs will be removed when Fedora CoreOS publishes arm64 AMIs
# and may be removed for any reason before then as well. Do not use.
data "aws_ami" "fedora-coreos-arm" {
count = var.arch == "arm64" ? 1 : 0

most_recent = true
owners = ["099663496933"]

Expand Down
2 changes: 1 addition & 1 deletion aws/fedora-coreos/kubernetes/controllers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "aws_instance" "controllers" {
}

instance_type = var.controller_type
ami = var.arch == "arm64" ? data.aws_ami.fedora-coreos-arm.image_id : data.aws_ami.fedora-coreos.image_id
ami = var.arch == "arm64" ? data.aws_ami.fedora-coreos-arm[0].image_id : data.aws_ami.fedora-coreos.image_id
user_data = data.ct_config.controller-ignitions.*.rendered[count.index]

# storage
Expand Down
2 changes: 2 additions & 0 deletions aws/fedora-coreos/kubernetes/workers/ami.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ data "aws_ami" "fedora-coreos" {
# WARNING: These AMIs will be removed when Fedora CoreOS publishes arm64 AMIs
# and may be removed for any reason before then as well. Do not use.
data "aws_ami" "fedora-coreos-arm" {
count = var.arch == "arm64" ? 1 : 0

most_recent = true
owners = ["099663496933"]

Expand Down
2 changes: 1 addition & 1 deletion aws/fedora-coreos/kubernetes/workers/workers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ resource "aws_autoscaling_group" "workers" {

# Worker template
resource "aws_launch_configuration" "worker" {
image_id = var.arch == "arm64" ? data.aws_ami.fedora-coreos-arm.image_id : data.aws_ami.fedora-coreos.image_id
image_id = var.arch == "arm64" ? data.aws_ami.fedora-coreos-arm[0].image_id : data.aws_ami.fedora-coreos.image_id
instance_type = var.instance_type
spot_price = var.spot_price > 0 ? var.spot_price : null
enable_monitoring = false
Expand Down

0 comments on commit fa8f68f

Please sign in to comment.