Go Report |
Unit tests |
License |
|
|
|
The purpose of this project is to define a set of data sources
that make it easier to find the resources managed by SUSE on the different public clouds.
The provider gathers data by accessing the public instance of
public-cloud-info-service
managed by SUSE.
You can find more information about the resources managed by SUSE on the public clouds
here:
Using the Provider
Data source susepubliccloud_image_ids
Use this data source to get a list of image IDs matching
the specified criteria.
Example use:
data "susepubliccloud_image_ids" "sles" {
cloud = "amazon"
region = "eu-central-1"
state = "active"
name_regex = "suse-sles-15-sp1-byos.*-hvm-ssd-x86_64"
}
resource "aws_instance" "control_plane" {
ami = "${data.susepubliccloud_image_ids.sles.ids[0]}"
...
}
Argument reference
cloud
- (Required) Name of the target cloud to use. Valid values: amazon
,
google
, microsoft
and oracle
.
region
- (Required) One of the known regions in the cloud framework. Use the
region identifiers as the provider describes them, for example us-east-1
in
Amazon EC2, or East US 2
in Microsoft Azure.
state
- (Defaults to active
) State of the image. Valid values:
active
, inactive
, deprecated
. Note well: the deleted
state isn't
accepted by the data source because these images would not be usable by
terraform.
name_regex
- (Optional) A regex string to apply to the images list returned
by the remote API managed by SUSE.
sort_ascending
- (Defaults to false
) Used to sort by publication time.
Note well: the values accepted by cloud
, region
and state
are the ones
specified here.
Attributes reference
ids
is set to the list of images IDs, sorted by publication time according to
sort_ascending
.
Installing the Provider
openSUSE and SUSE packages are being built inside of the
systemsmanagement:terraform terraform-provider-susepubliccloud
project on the Open Build Service.
The packages can be installed by visiting the dedicated page
on software.opensuse.org.
Developing the Provider
If you wish to work on the provider, you'll need:
Note: This project uses Go Modules making it safe to work with it outside of your existing GOPATH. The instructions that follow assume a directory in your home directory outside of the standard GOPATH (i.e $HOME/development/terraform-providers/
).
Clone repository to: $HOME/development/terraform-providers/
$ mkdir -p $HOME/development/terraform-providers/; cd $HOME/development/terraform-providers/
$ git clone git@github.com:SUSE/terraform-provider-susepubliccloud
...
To compile the provider execute the following command:
$ make build
This will produce the terraform-provider-susepubliccloud
binary that can be
copied to your ~/.terraform.d/plugins/<GOOS>_<GOARCH>
directory.
More instructions about how to instead use a custom-built provider in your
Terraform environment can be found
here.
Testing
Unit tests can be run via:
$ make test
Unit test coverage can be seen by executing:
$ make test-coverage
Code can be linted via:
$ make lint