Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/data-sources/cluster_rosa_hcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ data "rhcs_cluster_rosa_hcp" "cluster" {
- `max_hcp_cluster_wait_timeout_in_minutes` (Number) This attribute is not supported for cluster data source. Therefore, it will not be displayed as an output of the datasource
- `max_machinepool_wait_timeout_in_minutes` (Number) This attribute is not supported for cluster data source. Therefore, it will not be displayed as an output of the datasource
- `name` (String) Name of the cluster. Cannot exceed 54 characters in length. After the creation of the resource, it is not possible to update the attribute value.
- `no_cni` (Boolean) Disable CNI creation to let users bring their own CNI. After the creation of the resource, it is not possible to update the attribute value.
- `ocm_properties` (Map of String) Merged properties defined by OCM and the user defined 'properties'.
- `pod_cidr` (String) Block of IP addresses for pods. After the creation of the resource, it is not possible to update the attribute value.
- `private` (Boolean) Provides private connectivity from your cluster's VPC to Red Hat SRE, without exposing traffic to the public internet. After the creation of the resource, it is not possible to update the attribute value.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/cluster_rosa_hcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ resource "rhcs_cluster_rosa_hcp" "rosa_sts_cluster" {
- `machine_cidr` (String) Block of IP addresses for nodes. After the creation of the resource, it is not possible to update the attribute value.
- `max_hcp_cluster_wait_timeout_in_minutes` (Number) This value sets the maximum duration in minutes to wait for a HCP cluster to be in a ready state.
- `max_machinepool_wait_timeout_in_minutes` (Number) This value sets the maximum duration in minutes to wait for machine pools to be in a ready state.
- `no_cni` (Boolean) Disable CNI creation to let users bring their own CNI. After the creation of the resource, it is not possible to update the attribute value.
- `pod_cidr` (String) Block of IP addresses for pods. After the creation of the resource, it is not possible to update the attribute value.
- `private` (Boolean) Provides private connectivity from your cluster's VPC to Red Hat SRE, without exposing traffic to the public internet. After the creation of the resource, it is not possible to update the attribute value.
- `properties` (Map of String) User defined properties. It is essential to include property 'role_creator_arn' with the value of the user creating the cluster. Example: properties = {rosa_creator_arn = data.aws_caller_identity.current.arn}
Expand Down
4 changes: 4 additions & 0 deletions provider/clusterrosa/hcp/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ func (r *ClusterRosaHcpDatasource) Schema(ctx context.Context, req datasource.Sc
Description: "Length of the prefix of the subnet assigned to each node. " + common.ValueCannotBeChangedStringDescription,
Computed: true,
},
"no_cni": schema.BoolAttribute{
Description: "Disable CNI creation to let users bring their own CNI. " + common.ValueCannotBeChangedStringDescription,
Computed: true,
},
"channel_group": schema.StringAttribute{
Description: deprecatedMessage,
Computed: true,
Expand Down
18 changes: 18 additions & 0 deletions provider/clusterrosa/hcp/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,14 @@ func (r *ClusterRosaHcpResource) Schema(ctx context.Context, req resource.Schema
int64planmodifier.UseStateForUnknown(),
},
},
"no_cni": schema.BoolAttribute{
Description: "Disable CNI creation to let users bring their own CNI. " + common.ValueCannotBeChangedStringDescription,
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{
boolplanmodifier.UseStateForUnknown(),
},
},
"channel_group": schema.StringAttribute{
Description: "Name of the channel group where you select the OpenShift cluster version, for example 'stable'. " +
"For ROSA, only 'stable' is supported. " + common.ValueCannotBeChangedStringDescription,
Expand Down Expand Up @@ -621,6 +629,9 @@ func createHcpClusterObject(ctx context.Context,
if common.HasValue(state.HostPrefix) {
network.HostPrefix(int(state.HostPrefix.ValueInt64()))
}
if common.BoolWithFalseDefault(state.NoCNI) {
network.Type("Other")
}
if !network.Empty() {
builder.Network(network)
}
Expand Down Expand Up @@ -949,6 +960,7 @@ func validateNoImmutableAttChange(state, plan *ClusterRosaHcpState) diag.Diagnos
common.ValidateStateAndPlanEquals(state.ServiceCIDR, plan.ServiceCIDR, "service_cidr", &diags)
common.ValidateStateAndPlanEquals(state.PodCIDR, plan.PodCIDR, "pod_cidr", &diags)
common.ValidateStateAndPlanEquals(state.HostPrefix, plan.HostPrefix, "host_prefix", &diags)
common.ValidateStateAndPlanEquals(state.NoCNI, plan.NoCNI, "no_cni", &diags)
common.ValidateStateAndPlanEquals(state.ChannelGroup, plan.ChannelGroup, "channel_group", &diags)

// STS field validations
Expand Down Expand Up @@ -1603,6 +1615,12 @@ func populateRosaHcpClusterState(ctx context.Context, object *cmv1.Cluster, stat
} else {
state.HostPrefix = types.Int64Null()
}
networkType, ok := object.Network().GetType()
if ok && networkType == "Other" {
state.NoCNI = types.BoolValue(true)
} else {
state.NoCNI = types.BoolNull()
}
channel_group, ok := object.Version().GetChannelGroup()
if ok {
state.ChannelGroup = types.StringValue(channel_group)
Expand Down
1 change: 1 addition & 0 deletions provider/clusterrosa/hcp/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type ClusterRosaHcpState struct {
MachineCIDR types.String `tfsdk:"machine_cidr"`
ServiceCIDR types.String `tfsdk:"service_cidr"`
HostPrefix types.Int64 `tfsdk:"host_prefix"`
NoCNI types.Bool `tfsdk:"no_cni"`
Proxy *proxy.Proxy `tfsdk:"proxy"`

// Standard machine pools fields
Expand Down