Skip to content

Commit 0a42112

Browse files
authored
Merge pull request #1062 from terraform-providers/release_merge_v3.75.0
Candidate for release_v3.75.0
2 parents 7dea394 + 9557d6b commit 0a42112

File tree

749 files changed

+4181
-2223
lines changed

Some content is hidden

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

749 files changed

+4181
-2223
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
## 3.75.0 (Unreleased)
2+
3+
### Added
4+
- Support resource discovery for limits resources
5+
- Support Terraform v0.12 syntax for resource discovery. Default is now v0.12 for generated configurations.
6+
- Support resource discovery for functions resources
7+
8+
### Fixed
9+
- Add missing attributes for `oci_file_storage_mount_target` import [Github issue #1037](https://github.com/terraform-providers/terraform-provider-oci/issues/1037)
10+
- Fixed the diff for `whitelisted_ips` arguments order in `oci_database_autonomous_database` resource [Issue #1050](https://github.com/terraform-providers/terraform-provider-oci/issues/1050)
11+
- Fixed the `placement_configs` order mismatch in `oci_containerengine_node_pool` [GitHub issue #1045](https://github.com/terraform-providers/terraform-provider-oci/issues/1045)
12+
- Fixed Instance Metadata examples to use the Instance Metadata Service version 2
13+
214
## 3.74.0 (May 06, 2020)
315

416
### Added

examples/compute/extended_metadata/extended_metadata.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ resource "null_resource" "remote-exec" {
125125

126126
inline = [
127127
#For more info on accessing metadata see https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/gettingmetadata.htm
128-
"export STR=$(curl http://169.254.169.254/opc/v1/instance/metadata/nested_object/object/some_string)",
128+
"export STR=$(curl --header \"Authorization: Bearer Oracle\" http://169.254.169.254/opc/v2/instance/metadata/nested_object/object/some_string)",
129129

130130
"if [[ \"$STR\" != \"stringC\" ]]; then exit 1; fi",
131131
]

examples/compute/windows/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ This example contains Terraform configuration to provision a virtual machine in
7575
- From the VM instance you can run the following commands to get the metadata
7676

7777
```powershell
78-
curl http://169.254.169.254/opc/v1/instance/
79-
curl http://169.254.169.254/opc/v1/instance/metadata/
80-
curl http://169.254.169.254/opc/v1/instance/metadata/<any-key-name>
78+
curl -H @{\"Authorization\"='Bearer Oracle'} http://169.254.169.254/opc/v2/instance/
79+
curl -H @{\"Authorization\"='Bearer Oracle'} http://169.254.169.254/opc/v2/instance/metadata/
80+
curl -H @{\"Authorization\"='Bearer Oracle'} http://169.254.169.254/opc/v2/instance/metadata/<any-key-name>
8181
8282
# To get user_data
83-
curl http://169.254.169.254/opc/v1/instance/metadata/user_data
83+
curl -H @{\"Authorization\"='Bearer Oracle'} http://169.254.169.254/opc/v2/instance/metadata/user_data
8484
```
8585

8686
- If you are facing issues with connecting or using WinRM from Terraform through remote-exec, an alternative approach can be to use local-exec with another library like [pywinrm](https://github.com/diyan/pywinrm)

examples/container_engine/regional_subnet/cluster.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ resource "oci_containerengine_node_pool" "test_node_pool" {
5151

5252
node_config_details {
5353
placement_configs {
54-
availability_domain = "${data.oci_identity_availability_domain.ad1.name}"
55-
subnet_id = "${oci_core_subnet.node_pool_regional_subnet_1.id}"
54+
availability_domain = "${data.oci_identity_availability_domain.ad2.name}"
55+
subnet_id = "${oci_core_subnet.node_pool_regional_subnet_2.id}"
5656
}
5757

5858
placement_configs {
59-
availability_domain = "${data.oci_identity_availability_domain.ad2.name}"
60-
subnet_id = "${oci_core_subnet.node_pool_regional_subnet_2.id}"
59+
availability_domain = "${data.oci_identity_availability_domain.ad1.name}"
60+
subnet_id = "${oci_core_subnet.node_pool_regional_subnet_1.id}"
6161
}
6262

6363
size = 4
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
yum update -y
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
// Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
2+
3+
# This is an example of how to resize a volume that’s attached and online without having to reattach it.
4+
# The null provisioner ensures that a rescan command is run when the volume size has changed
5+
6+
variable "tenancy_ocid" {}
7+
variable "user_ocid" {}
8+
variable "fingerprint" {}
9+
variable "private_key_path" {}
10+
variable "region" {}
11+
12+
variable "compartment_ocid" {}
13+
14+
variable "ssh_public_key" {
15+
default = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDM+NcnBp1i4iKNeYf853h0UA2GVLOaa+85lZGykQJMzOWcS3oB3OHVN1nRrS6foQQ7EuNpEMlxfKESCFKh4UQynzb3pWmy/dczPP/EwQY061v0uPJ5tb2SlYgExFt+gzgBpKejEVdN+OH8Jt63+YIadaSbPHdjUYU2xckMXbeYe0mGXJEUdAtcurML81V0BfMEA7TCPVxXf8Fl2JcIHhuMdJv/VfjxAIqA8tj7fI2hqFs4Cf2zMF4nKvHHgkDCXIiqhjOY+R2B44eQHXzXtTlqUr5XgHD3tGbvt+mcfuQr/eV1pnBbIteop/XHpyS0MKJctfeod8+glEukjSfzQwhL0hJ8JVxlidOcoYEIrAIKm0RLDYd4kO5FvChUps1yzm+bVYgQrFkUtzUu9oMpqc053Y0CPJ5YZu50nlx8syzhXtDKItXLifFrf8ekcmsPA2X6G9/v/YXcVUX4Rq1fftwua4Ftl4JQU/3A6Jiw5OSEPz8jf4Z5edGNcBCnPzeCdFkpxbkN/XFNb0azDq+6ke1XhKdj+WrWZedJSXzxP8Iur2ZVlMLIytFhypnZj82hImCRJnXGthrxvklzWT6Wm2znzUvZL0kUbZVSRCIA0oULc1l9pX22zgjfqtifjPiCH+d41FUINBKBHwkRObQ3xQ/RttRqYDYLjSPphqR3phO6fw== <[email protected]>"
16+
}
17+
18+
variable "ssh_private_key" {
19+
default = "~/.ssh/id_rsa"
20+
}
21+
22+
provider "oci" {
23+
tenancy_ocid = "${var.tenancy_ocid}"
24+
user_ocid = "${var.user_ocid}"
25+
fingerprint = "${var.fingerprint}"
26+
private_key_path = "${var.private_key_path}"
27+
region = "${var.region}"
28+
}
29+
30+
variable "instance_shape" {
31+
default = "VM.Standard2.1"
32+
}
33+
34+
variable "instance_image_ocid" {
35+
type = "map"
36+
37+
default = {
38+
# See https://docs.us-phoenix-1.oraclecloud.com/images/
39+
# Oracle-provided image "CentOS-6.10-2020.04.21-0"
40+
eu-frankfurt-1 = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaajubunwtkoob57bkjgsdinb6xjqgggwkn7hjt3j3lqdtrh72jcnaq"
41+
42+
uk-london-1 = "ocid1.image.oc1.uk-london-1.aaaaaaaaqxjy3ushb72q45cu2ekzvllnkgaf2pdnqyw7q3sv3krybzlcarxa"
43+
us-ashburn-1 = "ocid1.image.oc1.iad.aaaaaaaa27fldayogs4sre3l6arufehn6ist4u77hbylux5oisnarijlne7a"
44+
us-phoenix-1 = "ocid1.image.oc1.phx.aaaaaaaa66qzvli64ojblgjgzrqcutcynjqfinoiyib3u7vn4stauloyig3q"
45+
}
46+
}
47+
48+
variable "size" {
49+
default = "130" # size in GBs
50+
}
51+
52+
resource "oci_core_instance" "test_instance" {
53+
availability_domain = "${data.oci_identity_availability_domain.ad.name}"
54+
compartment_id = "${var.compartment_ocid}"
55+
display_name = "TestInstance1"
56+
shape = "${var.instance_shape}"
57+
58+
shape_config {
59+
ocpus = 1
60+
}
61+
62+
create_vnic_details {
63+
subnet_id = "${oci_core_subnet.test_subnet.id}"
64+
display_name = "Primaryvnic"
65+
assign_public_ip = true
66+
hostname_label = "tfexampleinstance1"
67+
}
68+
69+
source_details {
70+
source_type = "image"
71+
source_id = "${var.instance_image_ocid[var.region]}"
72+
73+
# Apply this to set the size of the boot volume that's created for this instance.
74+
# Otherwise, the default boot volume size of the image is used.
75+
# This should only be specified when source_type is set to "image".
76+
#boot_volume_size_in_gbs = "60"
77+
}
78+
79+
metadata = {
80+
ssh_authorized_keys = "${var.ssh_public_key}"
81+
user_data = "${base64encode(file("./userdata/bootstrap"))}"
82+
}
83+
84+
# Apply the following flag only if you wish to preserve the attached boot volume upon destroying this instance
85+
# Setting this and destroying the instance will result in a boot volume that should be managed outside of this config.
86+
# When changing this value, make sure to run 'terraform apply' so that it takes effect before the resource is destroyed.
87+
#preserve_boot_volume = true
88+
timeouts {
89+
create = "60m"
90+
}
91+
}
92+
93+
# Define the volumes that are attached to the compute instances.
94+
95+
resource "oci_core_volume" "test_block_volume" {
96+
availability_domain = "${data.oci_identity_availability_domain.ad.name}"
97+
compartment_id = "${var.compartment_ocid}"
98+
display_name = "TestBlock0"
99+
size_in_gbs = "${var.size}"
100+
}
101+
102+
resource "oci_core_volume_attachment" "test_block_attach" {
103+
attachment_type = "iscsi"
104+
instance_id = "${oci_core_instance.test_instance.*.id[0]}"
105+
volume_id = "${oci_core_volume.test_block_volume.*.id[0]}"
106+
device = "/dev/oracleoci/oraclevdb"
107+
108+
# Set this to enable CHAP authentication for an ISCSI volume attachment. The oci_core_volume_attachment resource will
109+
# contain the CHAP authentication details via the "chap_secret" and "chap_username" attributes.
110+
use_chap = true
111+
112+
# Set this to attach the volume as read-only.
113+
#is_read_only = true
114+
}
115+
116+
resource "null_resource" "remote-exec" {
117+
depends_on = ["oci_core_instance.test_instance", "oci_core_volume_attachment.test_block_attach"]
118+
119+
provisioner "remote-exec" {
120+
connection {
121+
agent = false
122+
timeout = "30m"
123+
host = "${oci_core_instance.test_instance.*.public_ip[0]}"
124+
user = "opc"
125+
private_key = "${file(var.ssh_private_key)}"
126+
}
127+
128+
inline = [
129+
"touch ~/IMadeAFile.Right.Here",
130+
"sudo iscsiadm -m node -o new -T ${oci_core_volume_attachment.test_block_attach.*.iqn[0]} -p ${oci_core_volume_attachment.test_block_attach.*.ipv4[0]}:${oci_core_volume_attachment.test_block_attach.*.port[0]}",
131+
"sudo iscsiadm -m node -o update -T ${oci_core_volume_attachment.test_block_attach.*.iqn[0]} -n node.startup -v automatic",
132+
"sudo iscsiadm -m node -T ${oci_core_volume_attachment.test_block_attach.*.iqn[0]} -p ${oci_core_volume_attachment.test_block_attach.*.ipv4[0]}:${oci_core_volume_attachment.test_block_attach.*.port[0]} -o update -n node.session.auth.authmethod -v CHAP",
133+
"sudo iscsiadm -m node -T ${oci_core_volume_attachment.test_block_attach.*.iqn[0]} -p ${oci_core_volume_attachment.test_block_attach.*.ipv4[0]}:${oci_core_volume_attachment.test_block_attach.*.port[0]} -o update -n node.session.auth.username -v ${oci_core_volume_attachment.test_block_attach.*.chap_username[0]}",
134+
"sudo iscsiadm -m node -T ${oci_core_volume_attachment.test_block_attach.*.iqn[0]} -p ${oci_core_volume_attachment.test_block_attach.*.ipv4[0]}:${oci_core_volume_attachment.test_block_attach.*.port[0]} -o update -n node.session.auth.password -v ${oci_core_volume_attachment.test_block_attach.*.chap_secret[0]}",
135+
"sudo iscsiadm -m node -T ${oci_core_volume_attachment.test_block_attach.*.iqn[0]} -p ${oci_core_volume_attachment.test_block_attach.*.ipv4[0]}:${oci_core_volume_attachment.test_block_attach.*.port[0]} -l",
136+
"sudo iscsiadm -m node -T ${oci_core_volume_attachment.test_block_attach.*.iqn[0]} -p ${oci_core_volume_attachment.test_block_attach.*.ipv4[0]}:${oci_core_volume_attachment.test_block_attach.*.port[0]} -l",
137+
138+
# if you are using the Oracle Linux 7.7, Ubuntu 16.04 or CentOS 7, please use the following commands.
139+
# If you are using windows, please comment it out.
140+
"sudo dd iflag=direct if=/dev/sdb of=/dev/null count=1",
141+
142+
"echo '1' | sudo tee /sys/class/block/sdb/device/rescan",
143+
]
144+
}
145+
146+
triggers = {
147+
always_run = "${oci_core_volume.test_block_volume.size_in_gbs}"
148+
}
149+
}
150+
151+
resource "oci_core_vcn" "test_vcn" {
152+
cidr_block = "10.1.0.0/16"
153+
compartment_id = "${var.compartment_ocid}"
154+
display_name = "TestVcn"
155+
dns_label = "testvcn"
156+
}
157+
158+
resource "oci_core_internet_gateway" "test_internet_gateway" {
159+
compartment_id = "${var.compartment_ocid}"
160+
display_name = "TestInternetGateway"
161+
vcn_id = "${oci_core_vcn.test_vcn.id}"
162+
}
163+
164+
resource "oci_core_default_route_table" "default_route_table" {
165+
manage_default_resource_id = "${oci_core_vcn.test_vcn.default_route_table_id}"
166+
display_name = "DefaultRouteTable"
167+
168+
route_rules {
169+
destination = "0.0.0.0/0"
170+
destination_type = "CIDR_BLOCK"
171+
network_entity_id = "${oci_core_internet_gateway.test_internet_gateway.id}"
172+
}
173+
}
174+
175+
resource "oci_core_subnet" "test_subnet" {
176+
availability_domain = "${data.oci_identity_availability_domain.ad.name}"
177+
cidr_block = "10.1.20.0/24"
178+
display_name = "TestSubnet"
179+
dns_label = "testsubnet"
180+
security_list_ids = ["${oci_core_vcn.test_vcn.default_security_list_id}"]
181+
compartment_id = "${var.compartment_ocid}"
182+
vcn_id = "${oci_core_vcn.test_vcn.id}"
183+
route_table_id = "${oci_core_vcn.test_vcn.default_route_table_id}"
184+
dhcp_options_id = "${oci_core_vcn.test_vcn.default_dhcp_options_id}"
185+
}
186+
187+
data "oci_identity_availability_domain" "ad" {
188+
compartment_id = "${var.tenancy_ocid}"
189+
ad_number = 1
190+
}

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ module github.com/terraform-providers/terraform-provider-oci
33
require (
44
github.com/aws/aws-sdk-go v1.25.2 // indirect
55
github.com/fatih/color v1.7.0
6-
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce
6+
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect
7+
github.com/hashicorp/hcl2 v0.0.0-20190618163856-0b64543c968c
78
github.com/hashicorp/terraform v0.12.4-0.20190628193153-a74738cd35fc
89
github.com/mitchellh/cli v1.0.0
9-
github.com/oracle/oci-go-sdk v19.1.0+incompatible
10+
github.com/oracle/oci-go-sdk v19.2.0+incompatible
1011
github.com/stretchr/objx v0.1.1 // indirect
1112
github.com/stretchr/testify v1.3.0
1213
gopkg.in/yaml.v2 v2.2.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ github.com/oracle/oci-go-sdk v19.0.0+incompatible h1:UQnOTZBLEtrqNnJ7jQJiaadScBQ
444444
github.com/oracle/oci-go-sdk v19.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
445445
github.com/oracle/oci-go-sdk v19.1.0+incompatible h1:UUt6LBPlbn+OnNMBxiHWzlwqSgMXy4xeTQTmJXvYgG4=
446446
github.com/oracle/oci-go-sdk v19.1.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
447+
github.com/oracle/oci-go-sdk v19.2.0+incompatible h1:BHsuizamIbAk6RJP1q36ygdIUgBLyjAKW9P5XSSDYdU=
448+
github.com/oracle/oci-go-sdk v19.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
447449
github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58 h1:m3CEgv3ah1Rhy82L+c0QG/U3VyY1UsvsIdkh0/rU97Y=
448450
github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk=
449451
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs=

main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func main() {
2525
var ids = flag.String("ids", "", "[export] Comma-separated list of resource IDs to export. The ID could either be an OCID or a Terraform import ID. By default, all resources are exported.")
2626
var generateStateFile = flag.Bool("generate_state", false, "[export][experimental] Set this to import the discovered resources into a state file along with the Terraform configuration")
2727
var help = flag.Bool("help", false, "Prints usage options")
28+
var tfVersion = flag.String("tf_version", "0.12", "The version of terraform syntax to generate for configurations. The state file will be written in v0.12 only. The allowed values are :\n * 0.11\n * 0.12")
2829

2930
flag.Parse()
3031
provider.PrintVersion()
@@ -44,11 +45,22 @@ func main() {
4445
} else {
4546
switch *command {
4647
case "export":
48+
49+
var terraformVersion provider.TfHclVersion
50+
if provider.TfVersionEnum(*tfVersion) == provider.TfVersion11 {
51+
terraformVersion = &provider.TfHclVersion11{Value: provider.TfVersionEnum(*tfVersion)}
52+
} else if *tfVersion == "" || provider.TfVersionEnum(*tfVersion) == provider.TfVersion12 {
53+
terraformVersion = &provider.TfHclVersion12{Value: provider.TfVersionEnum(*tfVersion)}
54+
} else {
55+
log.Printf("[ERROR]: Invalid tf_version '%s', supported values: 0.11, 0.12\n", *tfVersion)
56+
os.Exit(1)
57+
}
4758
args := &provider.ExportCommandArgs{
4859
CompartmentId: compartmentId,
4960
CompartmentName: compartmentName,
5061
OutputDir: outputPath,
5162
GenerateState: *generateStateFile,
63+
TFVersion: &terraformVersion,
5264
}
5365

5466
if services != nil && *services != "" {

oci/analytics_analytics_instance_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func AnalyticsAnalyticsInstanceDataSource() *schema.Resource {
2525
func readSingularAnalyticsAnalyticsInstance(d *schema.ResourceData, m interface{}) error {
2626
sync := &AnalyticsAnalyticsInstanceDataSourceCrud{}
2727
sync.D = d
28-
sync.Client = m.(*OracleClients).analyticsClient
28+
sync.Client = m.(*OracleClients).analyticsClient()
2929

3030
return ReadResource(sync)
3131
}

0 commit comments

Comments
 (0)