Skip to content

Commit de40f4d

Browse files
committed
Modify examples to Support IMDS v2 for Instance Metadata
1 parent 637d6ec commit de40f4d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
- Support for Online resize (grow) of block volume
66
- Support Terraform v0.12 syntax for resource discovery. Default is now v0.12 for generated configurations.
77
- Support resource discovery for functions resources
8+
-
89

910
### Fixed
1011
- Add missing attributes for `oci_file_storage_mount_target` import [Github issue #1037](https://github.com/terraform-providers/terraform-provider-oci/issues/1037)
1112
- 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)
1213
- Fixed the `placement_configs` order mismatch in `oci_containerengine_node_pool` [GitHub issue #1045](https://github.com/terraform-providers/terraform-provider-oci/issues/1045)
14+
- Fixed Instance Metadata examples to use the Instance Metadata Service version 2
1315

1416
## 3.74.0 (May 06, 2020)
1517

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)

0 commit comments

Comments
 (0)