provider/ignition: migration from resources to data resources (#11851)

* provider/ignition: migration from resources to data resources

* website: provider/ignition documention updated to data resources

* provider/ignition: backwards compatibility support for old resources
This commit is contained in:
Máximo Cuadros 2017-03-06 13:23:04 +01:00 committed by Paul Stack
parent 22f69b1592
commit b58709aa91
30 changed files with 161 additions and 195 deletions

View File

@ -17,7 +17,7 @@ import (
func Provider() terraform.ResourceProvider {
return &schema.Provider{
ResourcesMap: map[string]*schema.Resource{
DataSourcesMap: map[string]*schema.Resource{
"ignition_config": resourceConfig(),
"ignition_disk": resourceDisk(),
"ignition_raid": resourceRaid(),
@ -28,6 +28,44 @@ func Provider() terraform.ResourceProvider {
"ignition_user": resourceUser(),
"ignition_group": resourceGroup(),
},
ResourcesMap: map[string]*schema.Resource{
"ignition_config": schema.DataSourceResourceShim(
"ignition_config",
resourceConfig(),
),
"ignition_disk": schema.DataSourceResourceShim(
"ignition_disk",
resourceDisk(),
),
"ignition_raid": schema.DataSourceResourceShim(
"ignition_raid",
resourceRaid(),
),
"ignition_filesystem": schema.DataSourceResourceShim(
"ignition_filesystem",
resourceFilesystem(),
),
"ignition_file": schema.DataSourceResourceShim(
"ignition_file",
resourceFile(),
),
"ignition_systemd_unit": schema.DataSourceResourceShim(
"ignition_systemd_unit",
resourceSystemdUnit(),
),
"ignition_networkd_unit": schema.DataSourceResourceShim(
"ignition_networkd_unit",
resourceNetworkdUnit(),
),
"ignition_user": schema.DataSourceResourceShim(
"ignition_user",
resourceUser(),
),
"ignition_group": schema.DataSourceResourceShim(
"ignition_group",
resourceGroup(),
),
},
ConfigureFunc: func(*schema.ResourceData) (interface{}, error) {
return &cache{
disks: make(map[string]*types.Disk, 0),

View File

@ -26,9 +26,6 @@ var configReferenceResource = &schema.Resource{
func resourceConfig() *schema.Resource {
return &schema.Resource{
Create: resourceIgnitionFileCreate,
Update: resourceIgnitionFileCreate,
Delete: resourceIgnitionFileDelete,
Exists: resourceIgnitionFileExists,
Read: resourceIgnitionFileRead,
Schema: map[string]*schema.Schema{
@ -93,7 +90,7 @@ func resourceConfig() *schema.Resource {
}
}
func resourceIgnitionFileCreate(d *schema.ResourceData, meta interface{}) error {
func resourceIgnitionFileRead(d *schema.ResourceData, meta interface{}) error {
rendered, err := renderConfig(d, meta.(*cache))
if err != nil {
return err
@ -107,11 +104,6 @@ func resourceIgnitionFileCreate(d *schema.ResourceData, meta interface{}) error
return nil
}
func resourceIgnitionFileDelete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}
func resourceIgnitionFileExists(d *schema.ResourceData, meta interface{}) (bool, error) {
rendered, err := renderConfig(d, meta.(*cache))
if err != nil {
@ -121,10 +113,6 @@ func resourceIgnitionFileExists(d *schema.ResourceData, meta interface{}) (bool,
return hash(rendered) == d.Id(), nil
}
func resourceIgnitionFileRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
func renderConfig(d *schema.ResourceData, c *cache) (string, error) {
i, err := buildConfig(d, c)
if err != nil {

View File

@ -12,7 +12,7 @@ import (
func TestIngnitionFileReplace(t *testing.T) {
testIgnition(t, `
resource "ignition_config" "test" {
data "ignition_config" "test" {
replace {
source = "foo"
verification = "sha512-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
@ -38,7 +38,7 @@ func TestIngnitionFileReplace(t *testing.T) {
func TestIngnitionFileAppend(t *testing.T) {
testIgnition(t, `
resource "ignition_config" "test" {
data "ignition_config" "test" {
append {
source = "foo"
verification = "sha512-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
@ -95,7 +95,7 @@ var testTemplate = `
%s
output "rendered" {
value = "${ignition_config.test.rendered}"
value = "${data.ignition_config.test.rendered}"
}
`

View File

@ -7,8 +7,6 @@ import (
func resourceDisk() *schema.Resource {
return &schema.Resource{
Create: resourceDiskCreate,
Delete: resourceDiskDelete,
Exists: resourceDiskExists,
Read: resourceDiskRead,
Schema: map[string]*schema.Schema{
@ -60,7 +58,7 @@ func resourceDisk() *schema.Resource {
}
}
func resourceDiskCreate(d *schema.ResourceData, meta interface{}) error {
func resourceDiskRead(d *schema.ResourceData, meta interface{}) error {
id, err := buildDisk(d, meta.(*cache))
if err != nil {
return err
@ -70,11 +68,6 @@ func resourceDiskCreate(d *schema.ResourceData, meta interface{}) error {
return nil
}
func resourceDiskDelete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}
func resourceDiskExists(d *schema.ResourceData, meta interface{}) (bool, error) {
id, err := buildDisk(d, meta.(*cache))
if err != nil {
@ -84,10 +77,6 @@ func resourceDiskExists(d *schema.ResourceData, meta interface{}) (bool, error)
return id == d.Id(), nil
}
func resourceDiskRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
func buildDisk(d *schema.ResourceData, c *cache) (string, error) {
var partitions []types.Partition
for _, raw := range d.Get("partition").([]interface{}) {

View File

@ -9,7 +9,7 @@ import (
func TestIngnitionDisk(t *testing.T) {
testIgnition(t, `
resource "ignition_disk" "foo" {
data "ignition_disk" "foo" {
device = "/foo"
partition {
label = "qux"
@ -18,10 +18,10 @@ func TestIngnitionDisk(t *testing.T) {
type_guid = "01234567-89AB-CDEF-EDCB-A98765432101"
}
}
resource "ignition_config" "test" {
data "ignition_config" "test" {
disks = [
"${ignition_disk.foo.id}",
"${data.ignition_disk.foo.id}",
]
}
`, func(c *types.Config) error {
@ -58,3 +58,26 @@ func TestIngnitionDisk(t *testing.T) {
return nil
})
}
func TestIngnitionDiskResource(t *testing.T) {
testIgnition(t, `
resource "ignition_disk" "foo" {
device = "/foo"
partition {
label = "qux"
}
}
data "ignition_config" "test" {
disks = [
"${ignition_disk.foo.id}",
]
}
`, func(c *types.Config) error {
if len(c.Storage.Disks) != 1 {
return fmt.Errorf("disks, found %d", len(c.Storage.Disks))
}
return nil
})
}

View File

@ -10,8 +10,6 @@ import (
func resourceFile() *schema.Resource {
return &schema.Resource{
Create: resourceFileCreate,
Delete: resourceFileDelete,
Exists: resourceFileExists,
Read: resourceFileRead,
Schema: map[string]*schema.Schema{
@ -91,7 +89,7 @@ func resourceFile() *schema.Resource {
}
}
func resourceFileCreate(d *schema.ResourceData, meta interface{}) error {
func resourceFileRead(d *schema.ResourceData, meta interface{}) error {
id, err := buildFile(d, meta.(*cache))
if err != nil {
return err
@ -101,11 +99,6 @@ func resourceFileCreate(d *schema.ResourceData, meta interface{}) error {
return nil
}
func resourceFileDelete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}
func resourceFileExists(d *schema.ResourceData, meta interface{}) (bool, error) {
id, err := buildFile(d, meta.(*cache))
if err != nil {
@ -115,10 +108,6 @@ func resourceFileExists(d *schema.ResourceData, meta interface{}) (bool, error)
return id == d.Id(), nil
}
func resourceFileRead(d *schema.ResourceData, metacontent interface{}) error {
return nil
}
func buildFile(d *schema.ResourceData, c *cache) (string, error) {
_, hasContent := d.GetOk("content")
_, hasSource := d.GetOk("source")

View File

@ -9,7 +9,7 @@ import (
func TestIngnitionFile(t *testing.T) {
testIgnition(t, `
resource "ignition_file" "foo" {
data "ignition_file" "foo" {
filesystem = "foo"
path = "/foo"
content {
@ -19,8 +19,8 @@ func TestIngnitionFile(t *testing.T) {
uid = 42
gid = 84
}
resource "ignition_file" "qux" {
data "ignition_file" "qux" {
filesystem = "qux"
path = "/qux"
source {
@ -30,10 +30,10 @@ func TestIngnitionFile(t *testing.T) {
}
}
resource "ignition_config" "test" {
data "ignition_config" "test" {
files = [
"${ignition_file.foo.id}",
"${ignition_file.qux.id}",
"${data.ignition_file.foo.id}",
"${data.ignition_file.qux.id}",
]
}
`, func(c *types.Config) error {

View File

@ -9,8 +9,6 @@ import (
func resourceFilesystem() *schema.Resource {
return &schema.Resource{
Create: resourceFilesystemCreate,
Delete: resourceFilesystemDelete,
Exists: resourceFilesystemExists,
Read: resourceFilesystemRead,
Schema: map[string]*schema.Schema{
@ -59,7 +57,7 @@ func resourceFilesystem() *schema.Resource {
}
}
func resourceFilesystemCreate(d *schema.ResourceData, meta interface{}) error {
func resourceFilesystemRead(d *schema.ResourceData, meta interface{}) error {
id, err := buildFilesystem(d, meta.(*cache))
if err != nil {
return err
@ -69,11 +67,6 @@ func resourceFilesystemCreate(d *schema.ResourceData, meta interface{}) error {
return nil
}
func resourceFilesystemDelete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}
func resourceFilesystemExists(d *schema.ResourceData, meta interface{}) (bool, error) {
id, err := buildFilesystem(d, meta.(*cache))
if err != nil {
@ -83,10 +76,6 @@ func resourceFilesystemExists(d *schema.ResourceData, meta interface{}) (bool, e
return id == d.Id(), nil
}
func resourceFilesystemRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
func buildFilesystem(d *schema.ResourceData, c *cache) (string, error) {
var mount *types.FilesystemMount
if _, ok := d.GetOk("mount"); ok {

View File

@ -9,12 +9,12 @@ import (
func TestIngnitionFilesystem(t *testing.T) {
testIgnition(t, `
resource "ignition_filesystem" "foo" {
data "ignition_filesystem" "foo" {
name = "foo"
path = "/foo"
}
resource "ignition_filesystem" "qux" {
data "ignition_filesystem" "qux" {
name = "qux"
mount {
device = "/qux"
@ -22,7 +22,7 @@ func TestIngnitionFilesystem(t *testing.T) {
}
}
resource "ignition_filesystem" "bar" {
data "ignition_filesystem" "bar" {
name = "bar"
mount {
device = "/bar"
@ -32,11 +32,11 @@ func TestIngnitionFilesystem(t *testing.T) {
}
}
resource "ignition_config" "test" {
data "ignition_config" "test" {
filesystems = [
"${ignition_filesystem.foo.id}",
"${ignition_filesystem.qux.id}",
"${ignition_filesystem.bar.id}",
"${data.ignition_filesystem.foo.id}",
"${data.ignition_filesystem.qux.id}",
"${data.ignition_filesystem.bar.id}",
]
}
`, func(c *types.Config) error {

View File

@ -7,8 +7,6 @@ import (
func resourceGroup() *schema.Resource {
return &schema.Resource{
Create: resourceGroupCreate,
Delete: resourceGroupDelete,
Exists: resourceGroupExists,
Read: resourceGroupRead,
Schema: map[string]*schema.Schema{
@ -31,7 +29,7 @@ func resourceGroup() *schema.Resource {
}
}
func resourceGroupCreate(d *schema.ResourceData, meta interface{}) error {
func resourceGroupRead(d *schema.ResourceData, meta interface{}) error {
id, err := buildGroup(d, meta.(*cache))
if err != nil {
return err
@ -41,11 +39,6 @@ func resourceGroupCreate(d *schema.ResourceData, meta interface{}) error {
return nil
}
func resourceGroupDelete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}
func resourceGroupExists(d *schema.ResourceData, meta interface{}) (bool, error) {
id, err := buildGroup(d, meta.(*cache))
if err != nil {
@ -55,10 +48,6 @@ func resourceGroupExists(d *schema.ResourceData, meta interface{}) (bool, error)
return id == d.Id(), nil
}
func resourceGroupRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
func buildGroup(d *schema.ResourceData, c *cache) (string, error) {
return c.addGroup(&types.Group{
Name: d.Get("name").(string),

View File

@ -9,20 +9,20 @@ import (
func TestIngnitionGroup(t *testing.T) {
testIgnition(t, `
resource "ignition_group" "foo" {
data "ignition_group" "foo" {
name = "foo"
password_hash = "password"
gid = 42
}
resource "ignition_group" "qux" {
data "ignition_group" "qux" {
name = "qux"
}
resource "ignition_config" "test" {
}
data "ignition_config" "test" {
groups = [
"${ignition_group.foo.id}",
"${ignition_group.qux.id}",
"${data.ignition_group.foo.id}",
"${data.ignition_group.qux.id}",
]
}
`, func(c *types.Config) error {

View File

@ -7,8 +7,6 @@ import (
func resourceNetworkdUnit() *schema.Resource {
return &schema.Resource{
Create: resourceNetworkdUnitCreate,
Delete: resourceNetworkdUnitDelete,
Exists: resourceNetworkdUnitExists,
Read: resourceNetworkdUnitRead,
Schema: map[string]*schema.Schema{
@ -26,7 +24,7 @@ func resourceNetworkdUnit() *schema.Resource {
}
}
func resourceNetworkdUnitCreate(d *schema.ResourceData, meta interface{}) error {
func resourceNetworkdUnitRead(d *schema.ResourceData, meta interface{}) error {
id, err := buildNetworkdUnit(d, meta.(*cache))
if err != nil {
return err
@ -50,10 +48,6 @@ func resourceNetworkdUnitExists(d *schema.ResourceData, meta interface{}) (bool,
return id == d.Id(), nil
}
func resourceNetworkdUnitRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
func buildNetworkdUnit(d *schema.ResourceData, c *cache) (string, error) {
if err := validateUnitContent(d.Get("content").(string)); err != nil {
return "", err

View File

@ -9,14 +9,14 @@ import (
func TestIngnitionNetworkdUnit(t *testing.T) {
testIgnition(t, `
resource "ignition_networkd_unit" "foo" {
data "ignition_networkd_unit" "foo" {
name = "foo.link"
content = "[Match]\nName=eth0\n\n[Network]\nAddress=10.0.1.7\n"
}
resource "ignition_config" "test" {
data "ignition_config" "test" {
networkd = [
"${ignition_networkd_unit.foo.id}",
"${data.ignition_networkd_unit.foo.id}",
]
}
`, func(c *types.Config) error {

View File

@ -7,8 +7,6 @@ import (
func resourceRaid() *schema.Resource {
return &schema.Resource{
Create: resourceRaidCreate,
Delete: resourceRaidDelete,
Exists: resourceRaidExists,
Read: resourceRaidRead,
Schema: map[string]*schema.Schema{
@ -37,7 +35,7 @@ func resourceRaid() *schema.Resource {
}
}
func resourceRaidCreate(d *schema.ResourceData, meta interface{}) error {
func resourceRaidRead(d *schema.ResourceData, meta interface{}) error {
id, err := buildRaid(d, meta.(*cache))
if err != nil {
return err
@ -47,11 +45,6 @@ func resourceRaidCreate(d *schema.ResourceData, meta interface{}) error {
return nil
}
func resourceRaidDelete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}
func resourceRaidExists(d *schema.ResourceData, meta interface{}) (bool, error) {
id, err := buildRaid(d, meta.(*cache))
if err != nil {
@ -61,10 +54,6 @@ func resourceRaidExists(d *schema.ResourceData, meta interface{}) (bool, error)
return id == d.Id(), nil
}
func resourceRaidRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
func buildRaid(d *schema.ResourceData, c *cache) (string, error) {
var devices []types.Path
for _, value := range d.Get("devices").([]interface{}) {

View File

@ -9,16 +9,16 @@ import (
func TestIngnitionRaid(t *testing.T) {
testIgnition(t, `
resource "ignition_raid" "foo" {
data "ignition_raid" "foo" {
name = "foo"
level = "raid10"
devices = ["/foo"]
spares = 42
}
resource "ignition_config" "test" {
data "ignition_config" "test" {
arrays = [
"${ignition_raid.foo.id}",
"${data.ignition_raid.foo.id}",
]
}
`, func(c *types.Config) error {

View File

@ -7,8 +7,6 @@ import (
func resourceSystemdUnit() *schema.Resource {
return &schema.Resource{
Create: resourceSystemdUnitCreate,
Delete: resourceSystemdUnitDelete,
Exists: resourceSystemdUnitExists,
Read: resourceSystemdUnitRead,
Schema: map[string]*schema.Schema{
@ -56,7 +54,7 @@ func resourceSystemdUnit() *schema.Resource {
}
}
func resourceSystemdUnitCreate(d *schema.ResourceData, meta interface{}) error {
func resourceSystemdUnitRead(d *schema.ResourceData, meta interface{}) error {
id, err := buildSystemdUnit(d, meta.(*cache))
if err != nil {
return err
@ -66,11 +64,6 @@ func resourceSystemdUnitCreate(d *schema.ResourceData, meta interface{}) error {
return nil
}
func resourceSystemdUnitDelete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}
func resourceSystemdUnitExists(d *schema.ResourceData, meta interface{}) (bool, error) {
id, err := buildSystemdUnit(d, meta.(*cache))
if err != nil {
@ -80,10 +73,6 @@ func resourceSystemdUnitExists(d *schema.ResourceData, meta interface{}) (bool,
return id == d.Id(), nil
}
func resourceSystemdUnitRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
func buildSystemdUnit(d *schema.ResourceData, c *cache) (string, error) {
var dropins []types.SystemdUnitDropIn
for _, raw := range d.Get("dropin").([]interface{}) {

View File

@ -9,7 +9,7 @@ import (
func TestIngnitionSystemdUnit(t *testing.T) {
testIgnition(t, `
resource "ignition_systemd_unit" "foo" {
data "ignition_systemd_unit" "foo" {
name = "foo.service"
content = "[Match]\nName=eth0\n\n[Network]\nAddress=10.0.1.7\n"
enable = false
@ -21,9 +21,9 @@ func TestIngnitionSystemdUnit(t *testing.T) {
}
}
resource "ignition_config" "test" {
data "ignition_config" "test" {
systemd = [
"${ignition_systemd_unit.foo.id}",
"${data.ignition_systemd_unit.foo.id}",
]
}
`, func(c *types.Config) error {
@ -59,7 +59,7 @@ func TestIngnitionSystemdUnit(t *testing.T) {
func TestIngnitionSystemdUnitEmptyContentWithDropIn(t *testing.T) {
testIgnition(t, `
resource "ignition_systemd_unit" "foo" {
data "ignition_systemd_unit" "foo" {
name = "foo.service"
dropin {
name = "foo.conf"
@ -67,9 +67,9 @@ func TestIngnitionSystemdUnitEmptyContentWithDropIn(t *testing.T) {
}
}
resource "ignition_config" "test" {
data "ignition_config" "test" {
systemd = [
"${ignition_systemd_unit.foo.id}",
"${data.ignition_systemd_unit.foo.id}",
]
}
`, func(c *types.Config) error {
@ -98,14 +98,14 @@ func TestIngnitionSystemdUnitEmptyContentWithDropIn(t *testing.T) {
// #11325
func TestIgnitionSystemdUnit_emptyContent(t *testing.T) {
testIgnition(t, `
resource "ignition_systemd_unit" "foo" {
data "ignition_systemd_unit" "foo" {
name = "foo.service"
enable = true
enable = true
}
resource "ignition_config" "test" {
data "ignition_config" "test" {
systemd = [
"${ignition_systemd_unit.foo.id}",
"${data.ignition_systemd_unit.foo.id}",
]
}
`, func(c *types.Config) error {

View File

@ -9,8 +9,6 @@ import (
func resourceUser() *schema.Resource {
return &schema.Resource{
Create: resourceUserCreate,
Delete: resourceUserDelete,
Exists: resourceUserExists,
Read: resourceUserRead,
Schema: map[string]*schema.Schema{
@ -80,7 +78,7 @@ func resourceUser() *schema.Resource {
}
}
func resourceUserCreate(d *schema.ResourceData, meta interface{}) error {
func resourceUserRead(d *schema.ResourceData, meta interface{}) error {
id, err := buildUser(d, meta.(*cache))
if err != nil {
return err
@ -90,11 +88,6 @@ func resourceUserCreate(d *schema.ResourceData, meta interface{}) error {
return nil
}
func resourceUserDelete(d *schema.ResourceData, meta interface{}) error {
d.SetId("")
return nil
}
func resourceUserExists(d *schema.ResourceData, meta interface{}) (bool, error) {
id, err := buildUser(d, meta.(*cache))
if err != nil {
@ -104,10 +97,6 @@ func resourceUserExists(d *schema.ResourceData, meta interface{}) (bool, error)
return id == d.Id(), nil
}
func resourceUserRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
func buildUser(d *schema.ResourceData, c *cache) (string, error) {
uc := types.UserCreate{
Uid: getUInt(d, "uid"),

View File

@ -9,7 +9,7 @@ import (
func TestIngnitionUser(t *testing.T) {
testIgnition(t, `
resource "ignition_user" "foo" {
data "ignition_user" "foo" {
name = "foo"
password_hash = "password"
ssh_authorized_keys = ["keys"]
@ -24,14 +24,14 @@ func TestIngnitionUser(t *testing.T) {
shell = "shell"
}
resource "ignition_user" "qux" {
data "ignition_user" "qux" {
name = "qux"
}
resource "ignition_config" "test" {
data "ignition_config" "test" {
users = [
"${ignition_user.foo.id}",
"${ignition_user.qux.id}",
"${data.ignition_user.foo.id}",
"${data.ignition_user.qux.id}",
]
}
`, func(c *types.Config) error {

View File

@ -1,7 +1,7 @@
---
layout: "ignition"
page_title: "Ignition: ignition_config"
sidebar_current: "docs-ignition-resource-config"
sidebar_current: "docs-ignition-datasource-config"
description: |-
Renders an ignition configuration as JSON
---
@ -13,7 +13,7 @@ Renders an ignition configuration as JSON. It contains all the disks, partition
## Example Usage
```
resource "ignition_config" "example" {
data "ignition_config" "example" {
systemd = [
"${ignition_systemd_unit.example.id}",
]
@ -46,7 +46,7 @@ The following arguments are supported:
The `append` and `replace` blocks supports:
* `source` - (Required) The URL of the config. Supported schemes are http. Note: When using http, it is advisable to use the verification option to ensure the contents havent been modified.
* `verification` - (Optional) The hash of the config, in the form _\<type\>-\<value\>_ where type is sha512.

View File

@ -1,7 +1,7 @@
---
layout: "ignition"
page_title: "Ignition: ignition_disk"
sidebar_current: "docs-ignition-resource-disk"
sidebar_current: "docs-ignition-datasource-disk"
description: |-
Describes the desired state of a systems disk.
---
@ -13,7 +13,7 @@ Describes the desired state of a systems disk.
## Example Usage
```
resource "ignition_disk" "foo" {
data "ignition_disk" "foo" {
device = "/dev/sda"
partition {
start = 2048

View File

@ -1,7 +1,7 @@
---
layout: "ignition"
page_title: "Ignition: ignition_file"
sidebar_current: "docs-ignition-resource-file"
sidebar_current: "docs-ignition-datasource-file"
description: |-
Describes a file to be written in a particular filesystem.
---
@ -16,7 +16,7 @@ File with inline content:
```
resource "ignition_file" "hello" {
data "ignition_file" "hello" {
filesystem = "foo"
path = "/hello.txt"
content {
@ -28,7 +28,7 @@ resource "ignition_file" "hello" {
File with remote content:
```
resource "ignition_file" "hello" {
data "ignition_file" "hello" {
filesystem = "qux"
path = "/hello.txt"
source {

View File

@ -1,19 +1,19 @@
---
layout: "ignition"
page_title: "Ignition: ignition_filesystem"
sidebar_current: "docs-ignition-resource-filesystem"
sidebar_current: "docs-ignition-datasource-filesystem"
description: |-
Describes the desired state of a systems filesystem.
---
# ignition\_filesystem
Describes the desired state of a the systems filesystems to be configured and/or used with the _ignition\_file_ resource.
Describes the desired state of a the systems filesystems to be configured and/or used with the _ignition\_file_ resource.
## Example Usage
```
resource "ignition_filesystem" "foo" {
data "ignition_filesystem" "foo" {
name = "root"
mount {
device = "/dev/disk/by-label/ROOT"

View File

@ -1,7 +1,7 @@
---
layout: "ignition"
page_title: "Ignition: ignition_group"
sidebar_current: "docs-ignition-resource-group"
sidebar_current: "docs-ignition-datasource-group"
description: |-
Describes the desired group additions to the passwd database.
---
@ -13,7 +13,7 @@ Describes the desired group additions to the passwd database.
## Example Usage
```
resource "ignition_group" "foo" {
data "ignition_group" "foo" {
name = "foo"
}
```

View File

@ -1,7 +1,7 @@
---
layout: "ignition"
page_title: "Ignition: ignition_networkd_unit"
sidebar_current: "docs-ignition-resource-networkd-unit"
sidebar_current: "docs-ignition-datasource-networkd-unit"
description: |-
Describes the desired state of the networkd units.
---
@ -13,7 +13,7 @@ Describes the desired state of the networkd units.
## Example Usage
```
resource "ignition_networkd_unit" "example" {
data "ignition_networkd_unit" "example" {
name = "00-eth0.network"
content = "[Match]\nName=eth0\n\n[Network]\nAddress=10.0.1.7"
}

View File

@ -1,7 +1,7 @@
---
layout: "ignition"
page_title: "Ignition: ignition_raid"
sidebar_current: "docs-ignition-resource-raid"
sidebar_current: "docs-ignition-datasource-raid"
description: |-
Describes the desired state of the systems RAID.
---
@ -13,7 +13,7 @@ Describes the desired state of the systems RAID.
## Example Usage
```
resource "ignition_raid" "md" {
data "ignition_raid" "md" {
name = "data"
level = "stripe"
devices = [
@ -22,7 +22,7 @@ resource "ignition_raid" "md" {
]
}
resource "ignition_disk" "disk1" {
data "ignition_disk" "disk1" {
device = "/dev/sdb"
wipe_table = true
partition {
@ -33,7 +33,7 @@ resource "ignition_disk" "disk1" {
}
}
resource "ignition_disk" "disk2" {
data "ignition_disk" "disk2" {
device = "/dev/sdc"
wipe_table = true
partition {

View File

@ -1,7 +1,7 @@
---
layout: "ignition"
page_title: "Ignition: ignition_systemd_unit"
sidebar_current: "docs-ignition-resource-systemd-unit"
sidebar_current: "docs-ignition-datasource-systemd-unit"
description: |-
Describes the desired state of the systemd units.
---
@ -13,7 +13,7 @@ Describes the desired state of the systemd units.
## Example Usage
```
resource "ignition_systemd_unit" "example" {
data "ignition_systemd_unit" "example" {
name = "example.service"
content = "[Service]\nType=oneshot\nExecStart=/usr/bin/echo Hello World\n\n[Install]\nWantedBy=multi-user.target"
}

View File

@ -1,7 +1,7 @@
---
layout: "ignition"
page_title: "Ignition: ignition_user"
sidebar_current: "docs-ignition-resource-user"
sidebar_current: "docs-ignition-datasource-user"
description: |-
Describes the desired user additions to the passwd database.
---
@ -13,7 +13,7 @@ Describes the desired user additions to the passwd database.
## Example Usage
```
resource "ignition_user" "foo" {
data "ignition_user" "foo" {
name = "foo"
home_dir = "/home/foo/"
shell = "/bin/bash"

View File

@ -19,16 +19,16 @@ Use the navigation to the left to read about the available resources.
This config will write a single service unit (shown below) with the contents of an example service. This unit will be enabled as a dependency of multi-user.target and therefore start on boot
```
# Systemd unit resource containing the unit definition
resource "ignition_systemd_unit" "example" {
name = "example.service"
# Systemd unit data resource containing the unit definition
data "ignition_systemd_unit" "example" {
name = "example.service"
content = "[Service]\nType=oneshot\nExecStart=/usr/bin/echo Hello World\n\n[Install]\nWantedBy=multi-user.target"
}
# Ingnition config include the previous defined systemd unit resource
resource "ignition_config" "example" {
# Ingnition config include the previous defined systemd unit data resource
data "ignition_config" "example" {
systemd = [
"${ignition_systemd_unit.example.id}",
"${data.ignition_systemd_unit.example.id}",
]
}
@ -36,6 +36,6 @@ resource "ignition_config" "example" {
resource "aws_instance" "web" {
# ...
user_data = "${ignition_config.example.rendered}"
user_data = "${data.ignition_config.example.rendered}"
}
```

View File

@ -10,18 +10,18 @@
<a href="/docs/providers/ignition/index.html">Ignition Provider</a>
</li>
<li<%= sidebar_current(/^docs-ignition-resource/) %>>
<a href="#">Resources</a>
<li<%= sidebar_current(/^docs-ignition-datasource/) %>>
<a href="#">Data Sources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-ignition-resource-config") %>><a href="/docs/providers/ignition/r/config.html">ignition_config</a></li>
<li<%= sidebar_current("docs-ignition-resource-disk") %>><a href="/docs/providers/ignition/r/disk.html">ignition_disk</a></li>
<li<%= sidebar_current("docs-ignition-resource-raid") %>><a href="/docs/providers/ignition/r/raid.html">ignition_raid</a></li>
<li<%= sidebar_current("docs-ignition-resource-filesystem") %>><a href="/docs/providers/ignition/r/filesystem.html">ignition_filesystem</a></li>
<li<%= sidebar_current("docs-ignition-resource-file") %>><a href="/docs/providers/ignition/r/file.html">ignition_file</a></li>
<li<%= sidebar_current("docs-ignition-resource-systemd-unit") %>><a href="/docs/providers/ignition/r/systemd_unit.html">ignition_systemd_unit</a></li>
<li<%= sidebar_current("docs-ignition-resource-networkd-unit") %>><a href="/docs/providers/ignition/r/networkd_unit.html">ignition_networkd_unit</a></li>
<li<%= sidebar_current("docs-ignition-resource-user") %>><a href="/docs/providers/ignition/r/user.html">ignition_user</a></li>
<li<%= sidebar_current("docs-ignition-resource-group") %>><a href="/docs/providers/ignition/r/group.html">ignition_group</a></li>
<li<%= sidebar_current("docs-ignition-datasource-config") %>><a href="/docs/providers/ignition/d/config.html">ignition_config</a></li>
<li<%= sidebar_current("docs-ignition-datasource-disk") %>><a href="/docs/providers/ignition/d/disk.html">ignition_disk</a></li>
<li<%= sidebar_current("docs-ignition-datasource-raid") %>><a href="/docs/providers/ignition/d/raid.html">ignition_raid</a></li>
<li<%= sidebar_current("docs-ignition-datasource-filesystem") %>><a href="/docs/providers/ignition/d/filesystem.html">ignition_filesystem</a></li>
<li<%= sidebar_current("docs-ignition-datasource-file") %>><a href="/docs/providers/ignition/d/file.html">ignition_file</a></li>
<li<%= sidebar_current("docs-ignition-datasource-systemd-unit") %>><a href="/docs/providers/ignition/d/systemd_unit.html">ignition_systemd_unit</a></li>
<li<%= sidebar_current("docs-ignition-datasource-networkd-unit") %>><a href="/docs/providers/ignition/d/networkd_unit.html">ignition_networkd_unit</a></li>
<li<%= sidebar_current("docs-ignition-datasource-user") %>><a href="/docs/providers/ignition/d/user.html">ignition_user</a></li>
<li<%= sidebar_current("docs-ignition-datasource-group") %>><a href="/docs/providers/ignition/d/group.html">ignition_group</a></li>
</li>
</ul>
</li>