Skip to content

Commit

Permalink
[D] Network Security Group
Browse files Browse the repository at this point in the history
[R] Add NSG
[R] Add NSG Action
[R] Add NSG Member
[R] Add NSG Member test
[R] Add NSG Rule

Sync go.mod with master

Update to 1.8.3

Add handle for 404
Add custom diff
update  custom diff
update  nil check

fix conflicts
  • Loading branch information
michaelkad authored and hkantare committed Oct 17, 2024
1 parent dd981e7 commit eae525f
Show file tree
Hide file tree
Showing 22 changed files with 3,393 additions and 38 deletions.
121 changes: 83 additions & 38 deletions ibm/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,44 +203,48 @@ var (
// For Power Colo

var (
Pi_auxiliary_volume_name string
Pi_cloud_instance_id string
Pi_dhcp_id string
Pi_host_group_id string
Pi_host_id string
Pi_image string
Pi_image_bucket_access_key string
Pi_image_bucket_file_name string
Pi_image_bucket_name string
Pi_image_bucket_region string
Pi_image_bucket_secret_key string
Pi_image_id string
Pi_instance_name string
Pi_key_name string
Pi_network_address_group_id string
Pi_network_name string
Pi_network_id string
Pi_network_interface_id string
Pi_placement_group_name string
Pi_replication_volume_name string
Pi_resource_group_id string
Pi_sap_image string
Pi_shared_processor_pool_id string
Pi_snapshot_id string
Pi_spp_placement_group_id string
Pi_storage_connection string
Pi_target_storage_tier string
Pi_volume_clone_task_id string
Pi_volume_group_id string
Pi_volume_group_name string
Pi_volume_id string
Pi_volume_name string
Pi_volume_onboarding_id string
Pi_volume_onboarding_source_crn string
PiCloudConnectionName string
PiSAPProfileID string
PiStoragePool string
PiStorageType string
Pi_auxiliary_volume_name string
Pi_cloud_instance_id string
Pi_dhcp_id string
Pi_host_group_id string
Pi_host_id string
Pi_image string
Pi_image_bucket_access_key string
Pi_image_bucket_file_name string
Pi_image_bucket_name string
Pi_image_bucket_region string
Pi_image_bucket_secret_key string
Pi_image_id string
Pi_instance_name string
Pi_key_name string
Pi_network_address_group_id string
Pi_network_id string
Pi_network_interface_id string
Pi_network_name string
Pi_network_security_group_id string
Pi_network_security_group_rule_id string
Pi_placement_group_name string
Pi_remote_id string
Pi_remote_type string
Pi_replication_volume_name string
Pi_resource_group_id string
Pi_sap_image string
Pi_shared_processor_pool_id string
Pi_snapshot_id string
Pi_spp_placement_group_id string
Pi_storage_connection string
Pi_target_storage_tier string
Pi_volume_clone_task_id string
Pi_volume_group_id string
Pi_volume_group_name string
Pi_volume_id string
Pi_volume_name string
Pi_volume_onboarding_id string
Pi_volume_onboarding_source_crn string
PiCloudConnectionName string
PiSAPProfileID string
PiStoragePool string
PiStorageType string
)

var (
Expand Down Expand Up @@ -1082,6 +1086,31 @@ func init() {
Pi_network_interface_id = "terraform-test-power"
fmt.Println("[INFO] Set the environment variable PI_NETWORK_INTERFACE_ID for testing ibm_pi_network_interface resource else it is set to default value 'terraform-test-power'")
}

Pi_network_security_group_id = os.Getenv("PI_NETWORK_SECURITY_GROUP_ID")
if Pi_network_security_group_id == "" {
Pi_network_security_group_id = "terraform-test-power"
fmt.Println("[INFO] Set the environment variable PI_NETWORK_SECURITY_GROUP_ID for testing ibm_pi_network_security_group resource else it is set to default value 'terraform-test-power'")
}

Pi_network_security_group_rule_id = os.Getenv("PI_NETWORK_SECURITY_GROUP_RULE_ID")
if Pi_network_security_group_rule_id == "" {
Pi_network_security_group_rule_id = "terraform-test-power"
fmt.Println("[INFO] Set the environment variable PI_NETWORK_SECURITY_GROUP_RULE_ID for testing ibm_pi_network_security_group resource else it is set to default value 'terraform-test-power'")
}

Pi_network_security_group_id = os.Getenv("PI_NETWORK_SECURITY_GROUP_ID")
if Pi_network_security_group_id == "" {
Pi_network_security_group_id = "terraform-test-power"
fmt.Println("[INFO] Set the environment variable PI_NETWORK_SECURITY_GROUP_ID for testing ibm_pi_network_security_group resource else it is set to default value 'terraform-test-power'")
}

Pi_network_security_group_rule_id = os.Getenv("PI_NETWORK_SECURITY_GROUP_RULE_ID")
if Pi_network_security_group_rule_id == "" {
Pi_network_security_group_rule_id = "terraform-test-power"
fmt.Println("[INFO] Set the environment variable PI_NETWORK_SECURITY_GROUP_RULE_ID for testing ibm_pi_network_security_group resource else it is set to default value 'terraform-test-power'")
}

Pi_volume_name = os.Getenv("PI_VOLUME_NAME")
if Pi_volume_name == "" {
Pi_volume_name = "terraform-test-power"
Expand Down Expand Up @@ -1171,21 +1200,37 @@ func init() {
Pi_placement_group_name = "tf-pi-placement-group"
fmt.Println("[WARN] Set the environment variable PI_PLACEMENT_GROUP_NAME for testing ibm_pi_placement_group resource else it is set to default value 'tf-pi-placement-group'")
}

Pi_remote_id = os.Getenv("PI_REMOTE_ID")
if Pi_remote_id == "" {
Pi_remote_id = "terraform-test-power"
fmt.Println("[WARN] Set the environment variable PI_REMOTE_ID for testing ibm_pi_network_security_group resource else it is set to default value 'terraform-test-power'")
}

Pi_remote_type = os.Getenv("PI_REMOTE_TYPE")
if Pi_remote_type == "" {
Pi_remote_type = "terraform-test-power"
fmt.Println("[WARN] Set the environment variable PI_REMOTE_TYPE for testing ibm_pi_network_security_group resource else it is set to default value 'terraform-test-power'")
}

Pi_spp_placement_group_id = os.Getenv("PI_SPP_PLACEMENT_GROUP_ID")
if Pi_spp_placement_group_id == "" {
Pi_spp_placement_group_id = "tf-pi-spp-placement-group"
fmt.Println("[WARN] Set the environment variable PI_SPP_PLACEMENT_GROUP_ID for testing ibm_pi_spp_placement_group resource else it is set to default value 'tf-pi-spp-placement-group'")
}

PiStoragePool = os.Getenv("PI_STORAGE_POOL")
if PiStoragePool == "" {
PiStoragePool = "terraform-test-power"
fmt.Println("[INFO] Set the environment variable PI_STORAGE_POOL for testing ibm_pi_storage_pool_capacity else it is set to default value 'terraform-test-power'")
}

PiStorageType = os.Getenv("PI_STORAGE_TYPE")
if PiStorageType == "" {
PiStorageType = "terraform-test-power"
fmt.Println("[INFO] Set the environment variable PI_STORAGE_TYPE for testing ibm_pi_storage_type_capacity else it is set to default value 'terraform-test-power'")
}

// Added for resource capture instance testing
Pi_capture_storage_image_path = os.Getenv("PI_CAPTURE_STORAGE_IMAGE_PATH")
if Pi_capture_storage_image_path == "" {
Expand Down
16 changes: 16 additions & 0 deletions ibm/flex/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,22 @@ func FlattenIntList(list []int) []interface{} {
return vs
}

func ExpandInt64List(input []interface{}) []int64 {
vs := make([]int64, len(input))
for i, v := range input {
vs[i] = v.(int64)
}
return vs
}

func FlattenInt64List(list []int64) []interface{} {
vs := make([]interface{}, len(list))
for i, v := range list {
vs[i] = v
}
return vs
}

func NewStringSet(f schema.SchemaSetFunc, in []string) *schema.Set {
var out = make([]interface{}, len(in), len(in))
for i, v := range in {
Expand Down
6 changes: 6 additions & 0 deletions ibm/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,8 @@ func Provider() *schema.Provider {
"ibm_pi_network_interface": power.DataSourceIBMPINetworkInterface(),
"ibm_pi_network_interfaces": power.DataSourceIBMPINetworkInterfaces(),
"ibm_pi_network_port": power.DataSourceIBMPINetworkPort(),
"ibm_pi_network_security_group": power.DataSourceIBMPINetworkSecurityGroup(),
"ibm_pi_network_security_groups": power.DataSourceIBMPINetworkSecurityGroups(),
"ibm_pi_network": power.DataSourceIBMPINetwork(),
"ibm_pi_networks": power.DataSourceIBMPINetworks(),
"ibm_pi_placement_group": power.DataSourceIBMPIPlacementGroup(),
Expand Down Expand Up @@ -1317,6 +1319,10 @@ func Provider() *schema.Provider {
"ibm_pi_network_address_group": power.ResourceIBMPINetworkAddressGroup(),
"ibm_pi_network_interface": power.ResourceIBMPINetworkInterface(),
"ibm_pi_network_port_attach": power.ResourceIBMPINetworkPortAttach(),
"ibm_pi_network_security_group_action": power.ResourceIBMPINetworkSecurityGroupAction(),
"ibm_pi_network_security_group_member": power.ResourceIBMPINetworkSecurityGroupMember(),
"ibm_pi_network_security_group_rule": power.ResourceIBMPINetworkSecurityGroupRule(),
"ibm_pi_network_security_group": power.ResourceIBMPINetworkSecurityGroup(),
"ibm_pi_network": power.ResourceIBMPINetwork(),
"ibm_pi_placement_group": power.ResourceIBMPIPlacementGroup(),
"ibm_pi_shared_processor_pool": power.ResourceIBMPISharedProcessorPool(),
Expand Down
Loading

0 comments on commit eae525f

Please sign in to comment.