Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork Sync: Update from parent repository #6

Merged
merged 22 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
878d021
add schemas and structs for scale rules types
jackofallops Sep 7, 2023
f4fd1d8
add scale rules with auth
jackofallops Sep 14, 2023
ebd476d
rework to cater for multiple auth blocks
jackofallops Sep 15, 2023
9185e1b
add docs update for scale rules
jackofallops Sep 15, 2023
46e3766
Add properties to error message (#23271)
nerddtvg Sep 18, 2023
73217f3
amend missing data source attributes (#23279)
lonegunmanb Sep 18, 2023
1fa32f2
`azurerm_postgresql_flexible_server` - support new value `4193280` fo…
neil-yechenwei Sep 18, 2023
400fc1d
Result of tsccr-helper -log-level=info -pin-all-workflows .
hashicorp-tsccr[bot] Sep 18, 2023
a8aef80
`azurerm_monitor_diagnostic_setting` - `retention_policy` deprecated …
teowa Sep 18, 2023
9045524
`azurerm_storage_account` - `azure_file_authentication.0.active_direc…
magodo Sep 18, 2023
bcd4057
Merge pull request #23293 from hashicorp/tsccr-auto-pinning/trusted/2…
tombuildsstuff Sep 18, 2023
4312f7d
helpers/validate: adding a test for .net's `TimeSpan.MaxValue` used b…
tombuildsstuff Sep 18, 2023
d7507e1
dependencies: downgrading to `v1.12.5` of `github.com/rickb777/date`
tombuildsstuff Sep 18, 2023
f50e3ca
`azurerm_storage_account` - For `Storage` kind account, avoid setting…
magodo Sep 18, 2023
b8ca12d
Merge pull request #23296 from hashicorp/b/iso8601-dateparsing
tombuildsstuff Sep 18, 2023
d402631
updating to include #23296
tombuildsstuff Sep 18, 2023
0d8a529
Removing #23272 from the changelog
tombuildsstuff Sep 18, 2023
c6c8bea
add validation for concurrent_requests
jackofallops Sep 18, 2023
c22a8b4
`azurerm_shared_image_version` - Support `replicated_region_deletion_…
ms-zhenhua Sep 18, 2023
ca842c0
`azurerm_monitor_scheduled_query_rules_alert_v2` - add doc for `metri…
teowa Sep 18, 2023
f339f95
Merge pull request #23294 from hashicorp/f/containerapp-scale-rules
jackofallops Sep 18, 2023
536c89a
Update CHANGELOG.md for #23294
jackofallops Sep 18, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/automation-open-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

- name: "open a pull request"
id: open-pr
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/breaking-change-detection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
detect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ./.go-version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/depscheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
depscheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ./.go-version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gencheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
gencheck:
runs-on: [custom, linux, large]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ./.go-version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
golint:
runs-on: [custom, linux, large]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ./.go-version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradually-deprecated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/increment-milestone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
increment-milestone:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
- name: "Increment Milestone"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-opened.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
issue_triage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: github/issue-labeler@98b5412841f6c4b0b3d9c29d53c13fad16bd7de2 # v3.2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

- name: Publish
uses: mhausenblas/mkdocs-deploy-gh-pages@d77dd03172e96abbcdb081d8c948224762033653 # 1.26
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/provider-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
if: needs.secrets-check.outputs.available == 'true'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

- name: Install Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-reviewed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
echo ${{ github.repository }} > wr_actions/ghrepo.txt
echo ${{ github.event.pull_request.number }} > wr_actions/prnumber.txt
echo "remove-waiting-response" > wr_actions/action.txt
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: artifact
path: wr_actions
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jobs:
outputs:
version: ${{ steps.go-version.outputs.version }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- id: go-version
run: echo "version=$(cat ./.go-version)" >>${GITHUB_OUTPUT}
release-notes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
- name: Generate Release Notes
run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > release-notes.txt
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: release-notes
path: release-notes.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/save-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
echo ${{ github.repository_owner }} > wr_actions/ghowner.txt
echo ${{ github.event.repository.name }} > wr_actions/ghrepo.txt
echo ${{ github.event.pull_request.number }} > wr_actions/prnumber.txt
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: artifact
path: wr_actions
4 changes: 2 additions & 2 deletions .github/workflows/teamcity-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
teamcity-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
with:
distribution: zulu
java-version: 17
java-package: jdk
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tflint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
tflint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ./.go-version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/thirty-two-bit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
compatibility-32bit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ./.go-version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
test:
runs-on: [custom, linux, large]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ./.go-version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
website-lint:
runs-on: [custom, linux, large]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ./.go-version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/website-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
website-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ./.go-version
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

ENHANCEMENTS:

* dependencies - swap Virtual Machine Scale Set Ids to `hashicorp/go-azure-helpers/commonids` [GH-23272]
* dependencies: downgrading to `v1.12.5` of `github.com/rickb777/date` [GH-23296]
* `azurerm_container_app` - add support for scale rules [GH-23294]

BUG FIXES:

* `azurerm_servicebus_queue` - fixing an issue where `auto_delete_on_idle` couldn't be set to `P10675199DT2H48M5.4775807S` [GH-23296]
* `azurerm_servicebus_topic` - fixing an issue where `auto_delete_on_idle` couldn't be set to `P10675199DT2H48M5.4775807S` [GH-23296]

## 3.73.0 (September 14, 2023)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/hashicorp/terraform-plugin-testing v1.5.1
github.com/magodo/terraform-provider-azurerm-example-gen v0.0.0-20220407025246-3a3ee0ab24a8
github.com/mitchellh/mapstructure v1.5.0
github.com/rickb777/date v1.20.2
github.com/rickb777/date v1.12.5-0.20200422084442-6300e543c4d9
github.com/sergi/go-diff v1.2.0
github.com/tombuildsstuff/giovanni v0.20.0
github.com/tombuildsstuff/kermit v0.20230703.1101016
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
Expand All @@ -192,12 +193,12 @@ github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DV
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rickb777/date v1.20.2 h1:CUpAaa4ksqvcRaidSgwzK7zeO2wUG5/VGy6Zlfcu/d4=
github.com/rickb777/date v1.20.2/go.mod h1:PVaM/Zn0IOzjm1uj84Eh9NJ/imtQSm1SVKtOvIunaYw=
github.com/rickb777/date v1.12.5-0.20200422084442-6300e543c4d9 h1:czJCcoUR3FMpHnRQow2E84H/0CPrX1fMAGn9HugzyI4=
github.com/rickb777/date v1.12.5-0.20200422084442-6300e543c4d9/go.mod h1:L8WrssTzvgYw34/Ppa0JpJfI7KKXZ2cVGI6Djt0brUU=
github.com/rickb777/plural v1.2.0/go.mod h1:UdpyWFCGbo3mvK3f/PfZOAOrkjzJlYN/sD46XNWJ+Es=
github.com/rickb777/plural v1.4.1 h1:5MMLcbIaapLFmvDGRT5iPk8877hpTPt8Y9cdSKRw9sU=
github.com/rickb777/plural v1.4.1/go.mod h1:kdmXUpmKBJTS0FtG/TFumd//VBWsNTD7zOw7x4umxNw=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
Expand Down
5 changes: 5 additions & 0 deletions helpers/validate/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ func TestISO8601Duration(t *testing.T) {
Value: "P1Y2M3DT7H42M3S",
Errors: 0,
},
{
// .Net's TimeSpan.Max value (used as the default value for ServiceBus Topics)
Value: "P10675199DT2H48M5.4775807S",
Errors: 0,
},
{
// Invalid prefix
Value: "1Y2M3DT7H42M3S",
Expand Down
25 changes: 25 additions & 0 deletions internal/services/compute/shared_image_version_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/Azure/go-autorest/autorest/date"
"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
Expand Down Expand Up @@ -99,6 +100,12 @@ func resourceSharedImageVersion() *pluginsdk.Resource {
ValidateFunc: validate.DiskEncryptionSetID,
},

"exclude_from_latest_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
},

// The Service API doesn't support to update `storage_account_type`. So it has to recreate the resource for updating `storage_account_type`.
// However, `ForceNew` cannot be used since resource would be recreated while adding or removing `target_region`.
// And `CustomizeDiff` also cannot be used since it doesn't support in a `Set`.
Expand Down Expand Up @@ -177,6 +184,13 @@ func resourceSharedImageVersion() *pluginsdk.Resource {
Default: false,
},

"deletion_of_replicated_locations_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
ForceNew: true,
Default: false,
},

"tags": tags.Schema(),
},

Expand Down Expand Up @@ -222,6 +236,9 @@ func resourceSharedImageVersionCreateUpdate(d *pluginsdk.ResourceData, meta inte
ReplicationMode: compute.ReplicationMode(d.Get("replication_mode").(string)),
TargetRegions: targetRegions,
},
SafetyProfile: &compute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: utils.Bool(d.Get("deletion_of_replicated_locations_enabled").(bool)),
},
StorageProfile: &compute.GalleryImageVersionStorageProfile{},
},
Tags: tags.Expand(d.Get("tags").(map[string]interface{})),
Expand Down Expand Up @@ -343,6 +360,10 @@ func resourceSharedImageVersionRead(d *pluginsdk.ResourceData, meta interface{})
d.Set("os_disk_snapshot_id", osDiskSnapShotID)
d.Set("storage_account_id", storageAccountID)
}

if safetyProfile := props.SafetyProfile; safetyProfile != nil {
d.Set("deletion_of_replicated_locations_enabled", pointer.From(safetyProfile.AllowDeletionOfReplicatedLocations))
}
}

return tags.FlattenAndSet(d, resp.Tags)
Expand Down Expand Up @@ -415,9 +436,11 @@ func expandSharedImageVersionTargetRegions(d *pluginsdk.ResourceData) (*[]comput
regionalReplicaCount := input["regional_replica_count"].(int)
storageAccountType := input["storage_account_type"].(string)
diskEncryptionSetId := input["disk_encryption_set_id"].(string)
excludeFromLatest := input["exclude_from_latest_enabled"].(bool)

output := compute.TargetRegion{
Name: utils.String(name),
ExcludeFromLatest: utils.Bool(excludeFromLatest),
RegionalReplicaCount: utils.Int32(int32(regionalReplicaCount)),
StorageAccountType: compute.StorageAccountType(storageAccountType),
}
Expand Down Expand Up @@ -463,6 +486,8 @@ func flattenSharedImageVersionTargetRegions(input *[]compute.TargetRegion) []int
}
output["disk_encryption_set_id"] = diskEncryptionSetId

output["exclude_from_latest_enabled"] = pointer.From(v.ExcludeFromLatest)

results = append(results, output)
}
}
Expand Down
46 changes: 46 additions & 0 deletions internal/services/compute/shared_image_version_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,29 @@ func TestAccSharedImageVersion_replicationMode(t *testing.T) {
})
}

func TestAccSharedImageVersion_replicatedRegionDeletion(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_shared_image_version", "test")
r := SharedImageVersionResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
// need to create a vm and then reference it in the image creation
Config: r.setup(data),
Check: acceptance.ComposeTestCheckFunc(
data.CheckWithClientForResource(ImageResource{}.virtualMachineExists, "azurerm_virtual_machine.testsource"),
data.CheckWithClientForResource(ImageResource{}.generalizeVirtualMachine(data), "azurerm_virtual_machine.testsource"),
),
},
{
Config: r.replicatedRegionDeletion(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func TestAccSharedImageVersion_requiresImport(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_shared_image_version", "test")
r := SharedImageVersionResource{}
Expand Down Expand Up @@ -697,3 +720,26 @@ resource "azurerm_shared_image_version" "test" {
}
`, template)
}

func (r SharedImageVersionResource) replicatedRegionDeletion(data acceptance.TestData) string {
template := r.provision(data)
return fmt.Sprintf(`
%s

resource "azurerm_shared_image_version" "test" {
name = "0.0.1"
gallery_name = azurerm_shared_image_gallery.test.name
image_name = azurerm_shared_image.test.name
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
managed_image_id = azurerm_image.test.id
deletion_of_replicated_locations_enabled = true

target_region {
name = azurerm_resource_group.test.location
regional_replica_count = 1
exclude_from_latest_enabled = true
}
}
`, template)
}
Loading
Loading