Skip to content

Commit

Permalink
[IF-846] EOL in Azure - terraform side (#47)
Browse files Browse the repository at this point in the history
Co-authored-by: Paweł Sternal <[email protected]>
  • Loading branch information
j-szaraszek and sternik authored Apr 14, 2023
1 parent 7506a74 commit 3c3ec3a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ terraform {
required_providers {
imagefactory = {
source = "nordcloud/imagefactory"
version = "1.5.1"
version = "1.5.2"
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ resource "imagefactory_template" "template" {
config {
azure {
exclude_from_latest = true
eol_date_option = true
replica_regions = ["westeurope"]
vm_image_definition {
name = "Ubuntu1804"
Expand Down Expand Up @@ -226,6 +227,7 @@ Optional:

Optional:

- `eol_date_option` (Boolean) Default value is set to true
- `exclude_from_latest` (Boolean)
- `replica_regions` (List of String)
- `vm_image_definition` (Block List) (see [below for nested schema](#nestedblock--config--azure--vm_image_definition))
Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ terraform {
required_providers {
imagefactory = {
source = "nordcloud/imagefactory"
version = "1.5.1"
version = "1.5.2"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions examples/resources/imagefactory_template/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ resource "imagefactory_template" "template" {
config {
azure {
exclude_from_latest = true
eol_date_option = true
replica_regions = ["westeurope"]
vm_image_definition {
name = "Ubuntu1804"
Expand Down
6 changes: 6 additions & 0 deletions imagefactory/imagetemplate/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ var azureTemplateConfigResource = &schema.Resource{
Type: schema.TypeBool,
Optional: true,
},
"eol_date_option": {
Type: schema.TypeBool,
Optional: true,
Default: true,
Description: "Default value is set to true",
},
"replica_regions": {
Type: schema.TypeList,
Optional: true,
Expand Down
3 changes: 3 additions & 0 deletions imagefactory/imagetemplate/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,16 @@ func expandTemplateAzureConfig(in []interface{}) *graphql.NewTemplateAZUREConfig

e := graphql.Boolean(m["exclude_from_latest"].(bool))

eol := graphql.Boolean(m["eol_date_option"].(bool))

rr := []graphql.String{}
for _, v := range m["replica_regions"].([]interface{}) {
rr = append(rr, graphql.String(v.(string)))
}

out := &graphql.NewTemplateAZUREConfig{
ExcludeFromLatest: &e,
EolDateOption: &eol,
ReplicaRegions: &rr,
VmImageDefinition: expandVMImageDefinitionTemplateAzureConfig(m["vm_image_definition"].([]interface{})),
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/graphql/graphql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ type VMImageDefinition {
type TemplateAZUREConfig {
replicaRegions: [String]
excludeFromLatest: Boolean
eolDateOption: Boolean
vmImageDefinition: VMImageDefinition
}

Expand Down Expand Up @@ -1089,6 +1090,7 @@ input NewVMImageDefinition {
input NewTemplateAZUREConfig {
replicaRegions: [String]
excludeFromLatest: Boolean
eolDateOption: Boolean = true
vmImageDefinition: NewVMImageDefinition
}

Expand Down

0 comments on commit 3c3ec3a

Please sign in to comment.