diff --git a/modules/aws/ami/README.md b/modules/aws/ami/README.md index 61f43f421e8..1c6072317ba 100644 --- a/modules/aws/ami/README.md +++ b/modules/aws/ami/README.md @@ -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" +} + +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/ diff --git a/modules/aws/ami/main.tf b/modules/aws/ami/main.tf index 1593457145e..9c9911d3e97 100644 --- a/modules/aws/ami/main.tf +++ b/modules/aws/ami/main.tf @@ -1,8 +1,3 @@ -provider "aws" { - region = "${var.region}" - version = "1.8.0" -} - locals { ami_owner = "595879546273" arn = "aws" diff --git a/modules/aws/ami/variables.tf b/modules/aws/ami/variables.tf index 5b84b10cdd5..49172b45eb8 100644 --- a/modules/aws/ami/variables.tf +++ b/modules/aws/ami/variables.tf @@ -1,12 +1,3 @@ -variable "region" { - type = "string" - - description = <