Skip to content

Commit 8b19f35

Browse files
committed
Update assign_public_ip field when importing
This addresses github issue #593
1 parent 1888bc4 commit 8b19f35

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## 3.1.2 (Unreleased)
22

33
### Fixed
4-
- Fixed bug with specifying lifecycle state in container enginge cluster datasource. Issue [#600](https://github.com/terraform-providers/terraform-provider-oci/issues/600)
4+
- Specifying lifecycle state in container engine cluster datasource. Issue [#600](https://github.com/terraform-providers/terraform-provider-oci/issues/600)
5+
- Importing the assign_public_ip attribute for instances. Issue [#593](https://github.com/terraform-providers/terraform-provider-oci/issues/593)
56

67
## 3.1.1 (September 21, 2018)
78

oci/core_instance_resource.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -790,9 +790,8 @@ func CreateVnicDetailsToMap(obj *oci_core.Vnic, createVnicDetails map[string]int
790790
assignPublicIP, _ := NormalizeBoolString(createVnicDetails["assign_public_ip"].(string)) // Must be valid.
791791
result["assign_public_ip"] = assignPublicIP
792792
} else {
793-
// Set to "true" in case "create_vnic_details" is ommited altogether & the default value for
794-
// "assign_public_ip" doesn't kick in.
795-
result["assign_public_ip"] = "true"
793+
// We may be importing this value; so let's set it to whether the public IP is set.
794+
result["assign_public_ip"] = strconv.FormatBool(obj.PublicIp != nil && *obj.PublicIp != "")
796795
}
797796

798797
if obj.DefinedTags != nil {

oci/core_instance_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ data "oci_core_instances" "test_instances" {
376376
ImportState: true,
377377
ImportStateVerify: true,
378378
ImportStateVerifyIgnore: []string{
379-
"create_vnic_details",
380379
// TODO: extended_metadata intentionally not set in resource Gets, even though supported
381380
// by GetInstance calls. Remove this when the issue is resolved.
382381
"extended_metadata",

0 commit comments

Comments
 (0)