Skip to content
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
37 changes: 25 additions & 12 deletions modules/aws/ami/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
# Container Linux AMI Module

This [Terraform][] [module][] supports `latest` versions for [Container Linux][container-linux] release channels and returns an appropriate [AMI][].
It uses [implicit provider inheritance][implicit-provider-inheritance] to access the [AWS provider][AWS-provider].

## Example

From the module directory:
Set up a `main.tf` with:

```hcl
provider "aws" {
region = "us-east-1"
}

module "ami" {
source = "github.com/openshift/installer//modules/aws/ami"
Comment thread
abhinavdahiya marked this conversation as resolved.
}

output "ami" {
value = "${module.ami.id}"
}
```

You can set `release_channel` and `release_version` if you need a specific Container Linux install.

Then run:

```console
$ terraform init
$ terraform apply --var region=us-east-1
$ terraform output id
ami-ab6963d4
$ terraform apply --var region=us-east-1 --var release_channel=alpha
$ terraform output id
ami-985953e7
$ terraform apply --var region=us-east-2 --var release_channel=alpha --var release_version=1814.0.0
$ terraform output id
ami-c25f66a7
$ terraform apply
$ terraform output ami
ami-00cc4337762ba4a52
```

When you're done, clean up by removing the `.terraform` directory created by `init` and the `terraform.tfstate*` files created by `apply`.

[AMI]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html
[AWS-provider]: https://www.terraform.io/docs/providers/aws/
[container-linux]: https://coreos.com/os/docs/latest/
[implicit-provider-inheritance]: https://www.terraform.io/docs/modules/usage.html#implicit-provider-inheritance
[module]: https://www.terraform.io/docs/modules/
[Terraform]: https://www.terraform.io/
5 changes: 0 additions & 5 deletions modules/aws/ami/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
provider "aws" {
region = "${var.region}"
version = "1.8.0"
}

locals {
ami_owner = "595879546273"
arn = "aws"
Expand Down
9 changes: 0 additions & 9 deletions modules/aws/ami/variables.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
variable "region" {
type = "string"

description = <<EOF
This is the AWS region.
It is passed through to the Terraform aws provider: https://www.terraform.io/docs/providers/aws/#region
EOF
}

variable "release_channel" {
type = "string"
default = "stable"
Expand Down
1 change: 0 additions & 1 deletion modules/aws/master/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ locals {
module "ami" {
source = "../ami"

region = "${var.region}"
release_channel = "${var.container_linux_channel}"
release_version = "${var.container_linux_version}"
}
Expand Down
9 changes: 0 additions & 9 deletions modules/aws/master/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,6 @@ variable "elb_console_id" {
type = "string"
}

variable "region" {
type = "string"

description = <<EOF
This is the AWS region.
It is passed through to the Terraform aws provider: https://www.terraform.io/docs/providers/aws/#region
EOF
}

variable "root_volume_iops" {
type = "string"
default = "100"
Expand Down
1 change: 0 additions & 1 deletion modules/aws/worker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ locals {
module "ami" {
source = "../ami"

region = "${var.region}"
release_channel = "${var.container_linux_channel}"
release_version = "${var.container_linux_version}"
}
Expand Down
9 changes: 0 additions & 9 deletions modules/aws/worker/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ variable "extra_tags" {
default = {}
}

variable "region" {
type = "string"

description = <<EOF
This is the AWS region.
It is passed through to the Terraform aws provider: https://www.terraform.io/docs/providers/aws/#region
EOF
}

variable "root_volume_type" {
type = "string"
description = "The type of volume for the root block device."
Expand Down
1 change: 0 additions & 1 deletion steps/bootstrap/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ data "ignition_config" "bootstrap_redirect" {
module "ami" {
source = "../../../modules/aws/ami"

region = "${var.tectonic_aws_region}"
release_channel = "${var.tectonic_container_linux_channel}"
release_version = "${var.tectonic_container_linux_version}"
}
Expand Down
2 changes: 0 additions & 2 deletions steps/infra/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module "masters" {
master_sg_ids = "${concat(var.tectonic_aws_master_extra_sg_ids, list(module.vpc.master_sg_id))}"
private_endpoints = "${local.private_endpoints}"
public_endpoints = "${local.public_endpoints}"
region = "${var.tectonic_aws_region}"
root_volume_iops = "${var.tectonic_aws_master_root_volume_iops}"
root_volume_size = "${var.tectonic_aws_master_root_volume_size}"
root_volume_type = "${var.tectonic_aws_master_root_volume_type}"
Expand All @@ -62,7 +61,6 @@ module "workers" {
extra_tags = "${var.tectonic_aws_extra_tags}"
instance_count = "${var.tectonic_worker_count}"
load_balancers = "${var.tectonic_aws_worker_load_balancers}"
region = "${var.tectonic_aws_region}"
root_volume_iops = "${var.tectonic_aws_worker_root_volume_iops}"
root_volume_size = "${var.tectonic_aws_worker_root_volume_size}"
root_volume_type = "${var.tectonic_aws_worker_root_volume_type}"
Expand Down