Skip to content

Commit 2aefa3e

Browse files
authored
Merge pull request #647 from terraform-providers/release
Release Terraform Provider 3.7.0
2 parents c8216b2 + 893cd52 commit 2aefa3e

File tree

92 files changed

+1141
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1141
-213
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
## 3.6.1 (Unreleased)
1+
## 3.7.0 (Unreleased)
2+
3+
### Added
4+
- New parameter `is_hydrated` in `oci_core_volume_groups` resource and data source
5+
- Support for public IP prefixes (CIDRs) up to 31
6+
- Support for tagging in `oci_file_storage_file_system`, `oci_file_storage_mount_target`, and `oci_file_storage_snapshot`
7+
8+
### Changed
9+
- Make `route_table_id`, `dhcp_options_id` in `oci_core_subnet` updatable
10+
- Make `security_list_ids` in `oci_core_subnet` optional and updatable
11+
12+
### Deprecated
13+
- Volumes: The `backup_policy_id` attribute is now deprecated. Backup policy should be assigned through `volume_backup_policy_assignments` resource instead.
14+
- BootVolumes: The `backup_policy_id` attribute is now deprecated. Backup policy should be assigned through `volume_backup_policy_assignments` resource instead.
15+
216
## 3.6.0 (November 01, 2018)
317

418
### Added

GNUmakefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ skip_goimports_check_flag := $(if $(skip_goimports_check), -s, )
1010

1111
default: build
1212

13+
## IMPORTANT: Do not modify the following `build` target. The following steps are a requirement of the provider release process.
1314
build: fmtcheck
1415
go install
1516

@@ -31,10 +32,26 @@ vet:
3132
fmt:
3233
gofmt -w $(GOFMT_FILES)
3334
goimports -w -local github.com/oracle/terraform-provider-oci $(GOFMT_FILES)
35+
@if [ -x "$$(command -v terraform)" ]; then \
36+
terraform fmt; \
37+
else \
38+
echo "No terraform command found. Not running 'terraform fmt'"; \
39+
fi
3440

41+
## IMPORTANT: Do not modify the following `fmtcheck` target. The following steps are a requirement of the provider release process.
42+
## To add custom checks, use the `ocicheck` target instead.
3543
fmtcheck:
3644
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh' $(skip_goimports_check_flag)"
3745

46+
ocicheck:
47+
@if [ -x "$$(command -v terraform)" ]; then \
48+
echo "==> Checking terraform formatting of files"; \
49+
terraform fmt -check=true || (echo "Terraform files are not appropriately formatted. Please run make fmt to format them." && exit 1); \
50+
else \
51+
echo "No terraform command found. Make sure it is installed in your PATH"; \
52+
exit 1; \
53+
fi
54+
3855
errcheck:
3956
@sh -c "'$(CURDIR)/scripts/errcheck.sh'"
4057

docs/examples/compute/instance_chef/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/examples/compute/omc_monitored_server/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

oci/core_boot_volume_resource.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ func BootVolumeResource() *schema.Resource {
7171

7272
// Optional
7373
"backup_policy_id": {
74-
Type: schema.TypeString,
75-
Optional: true,
76-
Computed: true,
77-
ForceNew: true,
74+
Type: schema.TypeString,
75+
Optional: true,
76+
Computed: true,
77+
ForceNew: true,
78+
Deprecated: FieldDeprecatedButSupportedTroughAnotherResource("backup_policy_id", "oci_core_volume_backup_policy_assignment"),
7879
},
7980
"defined_tags": {
8081
Type: schema.TypeMap,
@@ -345,7 +346,7 @@ func (s *BootVolumeResourceCrud) Update() error {
345346
}
346347
}
347348

348-
if sizeInGBs, ok := s.D.GetOkExists("size_in_gbs"); ok {
349+
if sizeInGBs, ok := s.D.GetOkExists("size_in_gbs"); ok && s.D.HasChange("size_in_gbs") {
349350
tmp := sizeInGBs.(string)
350351
tmpInt64, err := strconv.ParseInt(tmp, 10, 64)
351352
if err != nil {
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2+
3+
package provider
4+
5+
import (
6+
"testing"
7+
8+
"github.com/hashicorp/terraform/helper/resource"
9+
"github.com/hashicorp/terraform/terraform"
10+
"github.com/stretchr/testify/suite"
11+
)
12+
13+
type ResourceCoreBootVolumeTestSuite struct {
14+
suite.Suite
15+
Providers map[string]terraform.ResourceProvider
16+
Config string
17+
ResourceName string
18+
}
19+
20+
func (s *ResourceCoreBootVolumeTestSuite) SetupTest() {
21+
s.Providers = testAccProviders
22+
testAccPreCheck(s.T())
23+
s.Config = legacyTestProviderConfig() + `
24+
data "oci_identity_availability_domains" "test_availability_domains" {
25+
compartment_id = "${var.tenancy_ocid}"
26+
}
27+
28+
resource "oci_core_dhcp_options" "test_dhcp_options" {
29+
compartment_id = "${var.compartment_id}"
30+
options {
31+
server_type = "VcnLocalPlusInternet"
32+
type = "DomainNameServer"
33+
}
34+
options {
35+
search_domain_names = ["test.com"]
36+
type = "SearchDomain"
37+
}
38+
vcn_id = "${oci_core_vcn.test_vcn.id}"
39+
}
40+
41+
resource "oci_core_vcn" "test_vcn" {
42+
cidr_block = "10.0.0.0/16"
43+
compartment_id = "${var.compartment_id}"
44+
display_name = "-tf-vcn"
45+
dns_label = "dnslabel"
46+
freeform_tags = {
47+
"Department" = "Finance"
48+
}
49+
}
50+
51+
resource "oci_core_drg" "test_drg" {
52+
#Required
53+
compartment_id = "${var.compartment_id}"
54+
display_name = "-tf-drg"
55+
}
56+
57+
data "oci_core_services" "test_services" {}
58+
59+
resource "oci_core_internet_gateway" "test_network_entity" {
60+
compartment_id = "${var.compartment_id}"
61+
vcn_id = "${oci_core_vcn.test_vcn.id}"
62+
display_name = "-tf-internet-gateway"
63+
}
64+
65+
resource "oci_core_route_table" "test_route_table" {
66+
compartment_id = "${var.compartment_id}"
67+
route_rules {
68+
cidr_block = "0.0.0.0/0"
69+
network_entity_id = "${oci_core_internet_gateway.test_network_entity.id}"
70+
}
71+
vcn_id = "${oci_core_vcn.test_vcn.id}"
72+
}
73+
74+
resource "oci_core_subnet" "test_subnet" {
75+
availability_domain = "${lookup(data.oci_identity_availability_domains.test_availability_domains.availability_domains[0],"name")}"
76+
cidr_block = "10.0.0.0/16"
77+
compartment_id = "${var.compartment_id}"
78+
dhcp_options_id = "${oci_core_dhcp_options.test_dhcp_options.id}"
79+
display_name = "-tf-subnet"
80+
dns_label = "dnslabel"
81+
freeform_tags = {
82+
"Department" = "Accounting"
83+
}
84+
prohibit_public_ip_on_vnic = "false"
85+
route_table_id = "${oci_core_route_table.test_route_table.id}"
86+
security_list_ids = ["${oci_core_vcn.test_vcn.default_security_list_id}"]
87+
vcn_id = "${oci_core_vcn.test_vcn.id}"
88+
}
89+
90+
variable "InstanceImageOCID" {
91+
type = "map"
92+
default = {
93+
// See https://docs.us-phoenix-1.oraclecloud.com/images/
94+
// Oracle-provided image "Oracle-Linux-7.4-2018.02.21-1"
95+
us-phoenix-1 = "ocid1.image.oc1.phx.aaaaaaaaupbfz5f5hdvejulmalhyb6goieolullgkpumorbvxlwkaowglslq"
96+
us-ashburn-1 = "ocid1.image.oc1.iad.aaaaaaaajlw3xfie2t5t52uegyhiq2npx7bqyu4uvi2zyu3w3mqayc2bxmaa"
97+
eu-frankfurt-1 = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaa7d3fsb6272srnftyi4dphdgfjf6gurxqhmv6ileds7ba3m2gltxq"
98+
uk-london-1 = "ocid1.image.oc1.uk-london-1.aaaaaaaaa6h6gj6v4n56mqrbgnosskq63blyv2752g36zerymy63cfkojiiq"
99+
}
100+
}
101+
102+
resource "oci_core_instance" "test_instance" {
103+
availability_domain = "${lookup(data.oci_identity_availability_domains.test_availability_domains.availability_domains[0],"name")}"
104+
compartment_id = "${var.compartment_id}"
105+
image = "${var.InstanceImageOCID[var.region]}"
106+
shape = "VM.Standard1.8"
107+
subnet_id = "${oci_core_subnet.test_subnet.id}"
108+
display_name = "-tf-instance"
109+
}
110+
`
111+
112+
s.ResourceName = "oci_core_boot_volume.test_boot_volume"
113+
}
114+
115+
func (s *ResourceCoreBootVolumeTestSuite) TestResourceCoreBootVolume_basic() {
116+
var resId string
117+
resource.Test(s.T(), resource.TestCase{
118+
Providers: s.Providers,
119+
Steps: []resource.TestStep{
120+
// verify create
121+
{
122+
Config: s.Config +
123+
`
124+
resource "oci_core_boot_volume" "test_boot_volume" {
125+
availability_domain = "${lookup(data.oci_identity_availability_domains.test_availability_domains.availability_domains[0],"name")}"
126+
compartment_id = "${var.compartment_id}"
127+
source_details {
128+
id = "${oci_core_instance.test_instance.boot_volume_id}"
129+
type = "bootVolume"
130+
}
131+
display_name = "-tf-bootVolume-clone"
132+
size_in_gbs = "51"
133+
}
134+
135+
resource "oci_core_instance" "test_instance_new" {
136+
availability_domain = "${lookup(data.oci_identity_availability_domains.test_availability_domains.availability_domains[0],"name")}"
137+
compartment_id = "${var.compartment_id}"
138+
shape = "VM.Standard1.8"
139+
subnet_id = "${oci_core_subnet.test_subnet.id}"
140+
source_details {
141+
source_id = "${oci_core_boot_volume.test_boot_volume.id}"
142+
source_type = "bootVolume"
143+
}
144+
display_name = "-tf-instance-2"
145+
}
146+
`,
147+
Check: resource.ComposeAggregateTestCheckFunc(
148+
resource.TestCheckResourceAttrSet(s.ResourceName, "availability_domain"),
149+
resource.TestCheckResourceAttrSet(s.ResourceName, "time_created"),
150+
resource.TestCheckResourceAttr(s.ResourceName, "display_name", "-tf-bootVolume-clone"),
151+
resource.TestCheckResourceAttrSet(s.ResourceName, "time_created"),
152+
func(ts *terraform.State) (err error) {
153+
resId, err = fromInstanceState(ts, s.ResourceName, "id")
154+
return err
155+
},
156+
),
157+
},
158+
{
159+
Config: s.Config +
160+
`
161+
resource "oci_core_boot_volume" "test_boot_volume" {
162+
availability_domain = "${lookup(data.oci_identity_availability_domains.test_availability_domains.availability_domains[0],"name")}"
163+
compartment_id = "${var.compartment_id}"
164+
source_details {
165+
id = "${oci_core_instance.test_instance.boot_volume_id}"
166+
type = "bootVolume"
167+
}
168+
display_name = "-tf-bootVolume-2"
169+
size_in_gbs = "51"
170+
}
171+
172+
resource "oci_core_instance" "test_instance_new" {
173+
availability_domain = "${lookup(data.oci_identity_availability_domains.test_availability_domains.availability_domains[0],"name")}"
174+
compartment_id = "${var.compartment_id}"
175+
shape = "VM.Standard1.8"
176+
subnet_id = "${oci_core_subnet.test_subnet.id}"
177+
source_details {
178+
source_id = "${oci_core_boot_volume.test_boot_volume.id}"
179+
source_type = "bootVolume"
180+
}
181+
display_name = "-tf-instance-2"
182+
}
183+
`,
184+
Check: resource.ComposeAggregateTestCheckFunc(
185+
resource.TestCheckResourceAttrSet(s.ResourceName, "availability_domain"),
186+
resource.TestCheckResourceAttrSet(s.ResourceName, "time_created"),
187+
resource.TestCheckResourceAttr(s.ResourceName, "display_name", "-tf-bootVolume-2"),
188+
func(ts *terraform.State) (err error) {
189+
resId, err = fromInstanceState(ts, s.ResourceName, "id")
190+
return err
191+
},
192+
),
193+
},
194+
},
195+
})
196+
}
197+
198+
func TestResourceCoreBootVolumeTestSuite(t *testing.T) {
199+
suite.Run(t, new(ResourceCoreBootVolumeTestSuite))
200+
}

oci/core_service_gateway_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var (
3333
"vcn_id": Representation{repType: Required, create: `${oci_core_vcn.test_vcn.id}`},
3434
"defined_tags": Representation{repType: Optional, create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
3535
"display_name": Representation{repType: Optional, create: `displayName`, update: `displayName2`},
36-
"freeform_tags": Representation{repType: Optional, create: map[string]string{"bar-key": "value"}, update: map[string]string{"Department": "Accounting"}},
36+
"freeform_tags": Representation{repType: Optional, create: map[string]string{"Department": "Finance"}, update: map[string]string{"Department": "Accounting"}},
3737
}
3838
serviceGatewayServicesRepresentation = map[string]interface{}{
3939
"service_id": Representation{repType: Required, create: `${lookup(data.oci_core_services.test_services.services[0], "id")}`},

oci/core_subnet_resource.go

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ func SubnetResource() *schema.Resource {
5555
Type: schema.TypeString,
5656
Optional: true,
5757
Computed: true,
58-
ForceNew: true,
5958
},
6059
"display_name": {
6160
Type: schema.TypeString,
@@ -85,13 +84,11 @@ func SubnetResource() *schema.Resource {
8584
Type: schema.TypeString,
8685
Optional: true,
8786
Computed: true,
88-
ForceNew: true,
8987
},
9088
"security_list_ids": {
9189
Type: schema.TypeSet,
9290
Optional: true,
9391
Computed: true,
94-
ForceNew: true,
9592
MaxItems: 5,
9693
MinItems: 0,
9794
Set: literalTypeHashCodeForSets,
@@ -305,6 +302,11 @@ func (s *SubnetResourceCrud) Update() error {
305302
request.DefinedTags = convertedDefinedTags
306303
}
307304

305+
if dhcpOptionsId, ok := s.D.GetOkExists("dhcp_options_id"); ok {
306+
tmp := dhcpOptionsId.(string)
307+
request.DhcpOptionsId = &tmp
308+
}
309+
308310
if displayName, ok := s.D.GetOkExists("display_name"); ok {
309311
tmp := displayName.(string)
310312
request.DisplayName = &tmp
@@ -314,6 +316,24 @@ func (s *SubnetResourceCrud) Update() error {
314316
request.FreeformTags = objectMapToStringMap(freeformTags.(map[string]interface{}))
315317
}
316318

319+
if routeTableId, ok := s.D.GetOkExists("route_table_id"); ok {
320+
tmp := routeTableId.(string)
321+
request.RouteTableId = &tmp
322+
}
323+
324+
request.SecurityListIds = []string{}
325+
if securityListIds, ok := s.D.GetOkExists("security_list_ids"); ok {
326+
set := securityListIds.(*schema.Set)
327+
interfaces := set.List()
328+
tmp := make([]string, len(interfaces))
329+
for i := range interfaces {
330+
if interfaces[i] != nil {
331+
tmp[i] = interfaces[i].(string)
332+
}
333+
}
334+
request.SecurityListIds = tmp
335+
}
336+
317337
tmp := s.D.Id()
318338
request.SubnetId = &tmp
319339

oci/core_subnet_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,18 @@ var (
4141
"compartment_id": Representation{repType: Required, create: `${var.compartment_id}`},
4242
"vcn_id": Representation{repType: Required, create: `${oci_core_vcn.test_vcn.id}`},
4343
"defined_tags": Representation{repType: Optional, create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
44-
"dhcp_options_id": Representation{repType: Optional, create: `${oci_core_dhcp_options.test_dhcp_options.id}`},
44+
"dhcp_options_id": Representation{repType: Optional, create: `${oci_core_vcn.test_vcn.default_dhcp_options_id}`, update: `${oci_core_dhcp_options.test_dhcp_options.id}`},
4545
"display_name": Representation{repType: Optional, create: `MySubnet`, update: `displayName2`},
4646
"dns_label": Representation{repType: Optional, create: `dnslabel`},
4747
"freeform_tags": Representation{repType: Optional, create: map[string]string{"Department": "Finance"}, update: map[string]string{"Department": "Accounting"}},
4848
"prohibit_public_ip_on_vnic": Representation{repType: Optional, create: `false`},
49-
"route_table_id": Representation{repType: Optional, create: `${oci_core_route_table.test_route_table.id}`},
50-
"security_list_ids": Representation{repType: Optional, create: []string{`${oci_core_vcn.test_vcn.default_security_list_id}`}},
49+
"route_table_id": Representation{repType: Optional, create: `${oci_core_vcn.test_vcn.default_route_table_id}`, update: `${oci_core_route_table.test_route_table.id}`},
50+
"security_list_ids": Representation{repType: Optional, create: []string{`${oci_core_vcn.test_vcn.default_security_list_id}`}, update: []string{`${oci_core_security_list.test_security_list.id}`}},
5151
}
5252

53-
SubnetRequiredOnlyResourceDependencies = AvailabilityDomainConfig + VcnResourceConfig
54-
SubnetResourceDependencies = AvailabilityDomainConfig + DhcpOptionsRequiredOnlyResource + RouteTableRequiredOnlyResource
53+
AnotherSecurityListRequiredOnlyResource = generateResourceFromRepresentationMap("oci_core_security_list", "test_security_list", Required, Create, securityListRepresentation)
54+
SubnetRequiredOnlyResourceDependencies = AvailabilityDomainConfig + VcnResourceConfig
55+
SubnetResourceDependencies = AvailabilityDomainConfig + DhcpOptionsRequiredOnlyResource + RouteTableRequiredOnlyResource + AnotherSecurityListRequiredOnlyResource
5556
)
5657

5758
func TestCoreSubnetResource_basic(t *testing.T) {

0 commit comments

Comments
 (0)